Commit 326093f8 authored by E19C506H's avatar E19C506H
Browse files

noPackage

parent d21816e8
<?xml version="1.0" encoding="ASCII"?>
<java:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://www.eclipse.org/MoDisco/Java/0.2.incubation/java" name="Test">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="Foo">
<modifier visibility="public"/>
</ownedElements>
</ownedElements>
<ownedElements name="myPackage">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="ClassWithPackage">
<modifier visibility="public"/>
</ownedElements>
</ownedElements>
<orphanTypes xsi:type="java:PrimitiveTypeInt" name="int"/>
<orphanTypes xsi:type="java:PrimitiveTypeLong" name="long"/>
<orphanTypes xsi:type="java:PrimitiveTypeFloat" name="float"/>
<orphanTypes xsi:type="java:PrimitiveTypeDouble" name="double"/>
<orphanTypes xsi:type="java:PrimitiveTypeBoolean" name="boolean"/>
<orphanTypes xsi:type="java:PrimitiveTypeVoid" name="void"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<compilationUnits name="Foo.java" originalFilePath="D:\workSpace\Test\src\Foo.java" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="ClassWithPackage.java" originalFilePath="D:\workSpace\Test\src\myPackage\ClassWithPackage.java" package="//@ownedElements.1" types="//@ownedElements.1/@ownedElements.0"/>
</java:Model>
This diff is collapsed.
......@@ -68,4 +68,15 @@ helper def: switchDensity() : Set (smm!Measure) =
helper def: avoidStringBufferField() : Set(smm!Measure) =
java!FieldDeclaration.allInstances()
->select(dec | dec.type.type.name = 'StringBuffer' or dec.type.type.name = 'StringBuilder')
->collect(dec | thisModule.MeasureAvoidStringBufferField(dec));
\ No newline at end of file
->collect(dec | thisModule.MeasureAvoidStringBufferField(dec));
--====Khaled AMIRAT no package declaration
-- Rule for metrics noPackageDeclaration : return the set of class Measures that violates the rule.
helper def: noPackageDeclaration() : Set(smm!Measure) =
-- Browse through all class(CompilationUnit)
java!CompilationUnit.allInstances()
->select(compUnit | compUnit.package.oclIsUndefined())
->collect(err | thisModule.MesureAvoidNoPackageDeclaration(err));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment