Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Roxane MARECHAL
Source Code Analyzer
Commits
feb5d704
Commit
feb5d704
authored
Nov 23, 2019
by
Roxane Kang Maréchal
Browse files
Added start of implementatio for comment required
parent
d1ccc582
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
analysis-comment-required.launch
0 → 100644
View file @
feb5d704
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration
type=
"org.eclipse.m2m.atl.adt.launching.atlTransformation"
>
<stringAttribute
key=
"ATL File Name"
value=
"/projet-2019/src/main/atl/analysis.atl"
/>
<stringAttribute
key=
"ATL VM"
value=
"EMF-specific VM"
/>
<stringAttribute
key=
"ATL_COMPILER"
value=
"atl2006"
/>
<booleanAttribute
key=
"IS_REFINING"
value=
"false"
/>
<mapAttribute
key=
"Input"
>
<mapEntry
key=
"IN"
value=
"java"
/>
</mapAttribute>
<mapAttribute
key=
"Libs"
>
<mapEntry
key=
"bestPractices"
value=
"/projet-2019/src/main/atl/bestPractices.asm"
/>
<mapEntry
key=
"codestyle"
value=
"/projet-2019/src/main/atl/codestyle.asm"
/>
<mapEntry
key=
"design"
value=
"/projet-2019/src/main/atl/design.asm"
/>
<mapEntry
key=
"documentation"
value=
"/projet-2019/src/main/atl/documentation.asm"
/>
<mapEntry
key=
"multithreading"
value=
"/projet-2019/src/main/atl/multithreading.asm"
/>
<mapEntry
key=
"performance"
value=
"/projet-2019/src/main/atl/performance.asm"
/>
</mapAttribute>
<mapAttribute
key=
"Model Handler"
>
<mapEntry
key=
"java"
value=
"EMF"
/>
<mapEntry
key=
"smm"
value=
"EMF"
/>
</mapAttribute>
<mapAttribute
key=
"ModelType"
>
<mapEntry
key=
"IN"
value=
"MODELINPUT"
/>
<mapEntry
key=
"OUT"
value=
"MODELOUTPUT"
/>
<mapEntry
key=
"java"
value=
"METAMODELINPUT"
/>
<mapEntry
key=
"smm"
value=
"METAMODELOUTPUT"
/>
</mapAttribute>
<mapAttribute
key=
"Options"
>
<mapEntry
key=
"OPTION_CLEAR"
value=
"true"
/>
<mapEntry
key=
"OPTION_CONTENT_TYPE"
value=
"false"
/>
<mapEntry
key=
"OPTION_DERIVED"
value=
"true"
/>
<mapEntry
key=
"allowInterModelReferences"
value=
"false"
/>
<mapEntry
key=
"printExecutionTime"
value=
"true"
/>
<mapEntry
key=
"step"
value=
"false"
/>
<mapEntry
key=
"supportUML2Stereotypes"
value=
"false"
/>
</mapAttribute>
<listAttribute
key=
"OrderedInput"
>
<listEntry
value=
"IN"
/>
</listAttribute>
<listAttribute
key=
"OrderedOutput"
>
<listEntry
value=
"OUT"
/>
</listAttribute>
<mapAttribute
key=
"Output"
>
<mapEntry
key=
"OUT"
value=
"smm"
/>
</mapAttribute>
<mapAttribute
key=
"Path"
>
<mapEntry
key=
"IN"
value=
"/projet-2019/input/comment-required.xmi"
/>
<mapEntry
key=
"OUT"
value=
"/projet-2019/output/test.xmi"
/>
<mapEntry
key=
"java"
value=
"uri:http://www.eclipse.org/MoDisco/Java/0.2.incubation/java"
/>
<mapEntry
key=
"smm"
value=
"uri:http://www.eclipse.org/MoDisco/SMM/1.0.Beta2/smm"
/>
</mapAttribute>
<listAttribute
key=
"Superimpose"
/>
<stringAttribute
key=
"bad_container_name"
value=
"/projet-2019/analysis.launch"
/>
<listAttribute
key=
"org.eclipse.debug.ui.favoriteGroups"
>
<listEntry
value=
"org.eclipse.debug.ui.launchGroup.run"
/>
</listAttribute>
</launchConfiguration>
analysis-missing-break-for-a-switch-statement.launch
0 → 100644
View file @
feb5d704
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration
type=
"org.eclipse.m2m.atl.adt.launching.atlTransformation"
>
<stringAttribute
key=
"ATL File Name"
value=
"/projet-2019/src/main/atl/analysis.atl"
/>
<stringAttribute
key=
"ATL VM"
value=
"EMF-specific VM"
/>
<stringAttribute
key=
"ATL_COMPILER"
value=
"atl2006"
/>
<booleanAttribute
key=
"IS_REFINING"
value=
"false"
/>
<mapAttribute
key=
"Input"
>
<mapEntry
key=
"IN"
value=
"java"
/>
</mapAttribute>
<mapAttribute
key=
"Libs"
>
<mapEntry
key=
"bestPractices"
value=
"/projet-2019/src/main/atl/bestPractices.asm"
/>
<mapEntry
key=
"codestyle"
value=
"/projet-2019/src/main/atl/codestyle.asm"
/>
<mapEntry
key=
"design"
value=
"/projet-2019/src/main/atl/design.asm"
/>
<mapEntry
key=
"documentation"
value=
"/projet-2019/src/main/atl/documentation.asm"
/>
<mapEntry
key=
"errorProne"
value=
"/projet-2019/src/main/atl/errorProne.asm"
/>
<mapEntry
key=
"multithreading"
value=
"/projet-2019/src/main/atl/multithreading.asm"
/>
<mapEntry
key=
"performance"
value=
"/projet-2019/src/main/atl/performance.asm"
/>
</mapAttribute>
<mapAttribute
key=
"Model Handler"
>
<mapEntry
key=
"java"
value=
"EMF"
/>
<mapEntry
key=
"smm"
value=
"EMF"
/>
</mapAttribute>
<mapAttribute
key=
"ModelType"
>
<mapEntry
key=
"IN"
value=
"MODELINPUT"
/>
<mapEntry
key=
"OUT"
value=
"MODELOUTPUT"
/>
<mapEntry
key=
"java"
value=
"METAMODELINPUT"
/>
<mapEntry
key=
"smm"
value=
"METAMODELOUTPUT"
/>
</mapAttribute>
<mapAttribute
key=
"Options"
>
<mapEntry
key=
"OPTION_CLEAR"
value=
"true"
/>
<mapEntry
key=
"OPTION_CONTENT_TYPE"
value=
"false"
/>
<mapEntry
key=
"OPTION_DERIVED"
value=
"true"
/>
<mapEntry
key=
"allowInterModelReferences"
value=
"false"
/>
<mapEntry
key=
"printExecutionTime"
value=
"true"
/>
<mapEntry
key=
"step"
value=
"false"
/>
<mapEntry
key=
"supportUML2Stereotypes"
value=
"false"
/>
</mapAttribute>
<listAttribute
key=
"OrderedInput"
>
<listEntry
value=
"IN"
/>
</listAttribute>
<listAttribute
key=
"OrderedOutput"
>
<listEntry
value=
"OUT"
/>
</listAttribute>
<mapAttribute
key=
"Output"
>
<mapEntry
key=
"OUT"
value=
"smm"
/>
</mapAttribute>
<mapAttribute
key=
"Path"
>
<mapEntry
key=
"IN"
value=
"/projet-2019/input/missing-break-in-switch.xmi"
/>
<mapEntry
key=
"OUT"
value=
"/projet-2019/output/test.xmi"
/>
<mapEntry
key=
"java"
value=
"uri:http://www.eclipse.org/MoDisco/Java/0.2.incubation/java"
/>
<mapEntry
key=
"smm"
value=
"uri:http://www.eclipse.org/MoDisco/SMM/1.0.Beta2/smm"
/>
</mapAttribute>
<listAttribute
key=
"Superimpose"
/>
<stringAttribute
key=
"bad_container_name"
value=
"/projet-2019/analysis.launch"
/>
<listAttribute
key=
"org.eclipse.debug.ui.favoriteGroups"
>
<listEntry
value=
"org.eclipse.debug.ui.launchGroup.run"
/>
</listAttribute>
</launchConfiguration>
analysis-too-few-branches-for-a-switch-statement.launch
0 → 100644
View file @
feb5d704
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration
type=
"org.eclipse.m2m.atl.adt.launching.atlTransformation"
>
<stringAttribute
key=
"ATL File Name"
value=
"/projet-2019/src/main/atl/analysis.atl"
/>
<stringAttribute
key=
"ATL VM"
value=
"EMF-specific VM"
/>
<stringAttribute
key=
"ATL_COMPILER"
value=
"atl2006"
/>
<booleanAttribute
key=
"IS_REFINING"
value=
"false"
/>
<mapAttribute
key=
"Input"
>
<mapEntry
key=
"IN"
value=
"java"
/>
</mapAttribute>
<mapAttribute
key=
"Libs"
>
<mapEntry
key=
"bestPractices"
value=
"/projet-2019/src/main/atl/bestPractices.asm"
/>
<mapEntry
key=
"codestyle"
value=
"/projet-2019/src/main/atl/codestyle.asm"
/>
<mapEntry
key=
"design"
value=
"/projet-2019/src/main/atl/design.asm"
/>
<mapEntry
key=
"documentation"
value=
"/projet-2019/src/main/atl/documentation.asm"
/>
<mapEntry
key=
"errorProne"
value=
"/projet-2019/src/main/atl/errorProne.asm"
/>
<mapEntry
key=
"multithreading"
value=
"/projet-2019/src/main/atl/multithreading.asm"
/>
<mapEntry
key=
"performance"
value=
"/projet-2019/src/main/atl/performance.asm"
/>
</mapAttribute>
<mapAttribute
key=
"Model Handler"
>
<mapEntry
key=
"java"
value=
"EMF"
/>
<mapEntry
key=
"smm"
value=
"EMF"
/>
</mapAttribute>
<mapAttribute
key=
"ModelType"
>
<mapEntry
key=
"IN"
value=
"MODELINPUT"
/>
<mapEntry
key=
"OUT"
value=
"MODELOUTPUT"
/>
<mapEntry
key=
"java"
value=
"METAMODELINPUT"
/>
<mapEntry
key=
"smm"
value=
"METAMODELOUTPUT"
/>
</mapAttribute>
<mapAttribute
key=
"Options"
>
<mapEntry
key=
"OPTION_CLEAR"
value=
"true"
/>
<mapEntry
key=
"OPTION_CONTENT_TYPE"
value=
"false"
/>
<mapEntry
key=
"OPTION_DERIVED"
value=
"true"
/>
<mapEntry
key=
"allowInterModelReferences"
value=
"false"
/>
<mapEntry
key=
"printExecutionTime"
value=
"true"
/>
<mapEntry
key=
"step"
value=
"false"
/>
<mapEntry
key=
"supportUML2Stereotypes"
value=
"false"
/>
</mapAttribute>
<listAttribute
key=
"OrderedInput"
>
<listEntry
value=
"IN"
/>
</listAttribute>
<listAttribute
key=
"OrderedOutput"
>
<listEntry
value=
"OUT"
/>
</listAttribute>
<mapAttribute
key=
"Output"
>
<mapEntry
key=
"OUT"
value=
"smm"
/>
</mapAttribute>
<mapAttribute
key=
"Path"
>
<mapEntry
key=
"IN"
value=
"/projet-2019/input/too-few-branches-for-a-switch-statement.xmi"
/>
<mapEntry
key=
"OUT"
value=
"/projet-2019/output/test.xmi"
/>
<mapEntry
key=
"java"
value=
"uri:http://www.eclipse.org/MoDisco/Java/0.2.incubation/java"
/>
<mapEntry
key=
"smm"
value=
"uri:http://www.eclipse.org/MoDisco/SMM/1.0.Beta2/smm"
/>
</mapAttribute>
<listAttribute
key=
"Superimpose"
/>
<stringAttribute
key=
"bad_container_name"
value=
"/projet-2019/analysis.launch"
/>
<listAttribute
key=
"org.eclipse.debug.ui.favoriteGroups"
>
<listEntry
value=
"org.eclipse.debug.ui.launchGroup.run"
/>
</listAttribute>
</launchConfiguration>
analysis.launch
View file @
feb5d704
...
...
@@ -11,6 +11,7 @@
<mapEntry
key=
"bestPractices"
value=
"/projet-2019/src/main/atl/bestPractices.asm"
/>
<mapEntry
key=
"codestyle"
value=
"/projet-2019/src/main/atl/codestyle.asm"
/>
<mapEntry
key=
"design"
value=
"/projet-2019/src/main/atl/design.asm"
/>
<mapEntry
key=
"documentation"
value=
"/projet-2019/src/main/atl/documentation.asm"
/>
<mapEntry
key=
"multithreading"
value=
"/projet-2019/src/main/atl/multithreading.asm"
/>
<mapEntry
key=
"performance"
value=
"/projet-2019/src/main/atl/performance.asm"
/>
</mapAttribute>
...
...
input/comment-required.xmi
0 → 100644
View file @
feb5d704
This diff is collapsed.
Click to expand it.
src/main/atl/analysis.atl
View file @
feb5d704
...
...
@@ -9,6 +9,8 @@ uses design;
uses codestyle;
uses multithreading;
uses performance;
uses documentation;
uses bestPractices;
rule Java2SMM {
from
...
...
@@ -54,7 +56,10 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.uselessStringValueOf(),
thisModule.tooFewBranchesForASwitchStatement(),
thisModule.useIndexOfChar(),
thisModule.avoidPrintStackTrace()
thisModule.avoidPrintStackTrace(),
-- Documentation rules
thisModule.commentRequired()
};
...
...
@@ -361,3 +366,23 @@ rule MesureAvoidFieldNameMatchingMethodName(class : java!ClassDeclaration, metho
noc;
}
}
-- Creates a measure instance for each node that violates the rule : comment required
rule MeasureCommentRequired(element: java!ASTNode, violatedProperty: String) {
to
om: smm!ObservedMeasure (
measure <- commentRequired,
measurements <- measurement
),
commentRequired: smm!DimensionalMeasure (
name <- 'CommentRequired',
shortDescription <- 'Denotes whether comments are required (or unwanted) for specific language elements.'
),
measurement: smm!DirectMeasurement (
error <- 'Violated the property "' + violatedProperty + '"=Required in Class ' + element.originalCompilationUnit.name
)
do {
commentRequired;
}
}
\ No newline at end of file
src/main/atl/documentation.atl
0 → 100644
View file @
feb5d704
library documentation;
helper def: commentRequired() : Set(smm!Measure) =
java!ASTNode.allInstances()
-> select (node | thisModule.violatesCommentRequired(node))
-> collect (node | thisModule.MeasureCommentRequired(node))
;
helper def: violatesCommentRequired(node: java!ASTNode): Boolean =
false
;
helper def: commentRequiredPropertyCustomization() : Set(Map(String, String)) = Set{
Map{('methodWithOverrideCommentRequirement','Ignored')},
Map{('accessorCommentRequirement', 'Ignored')},
Map{('headerCommentRequirement', 'Required')},
Map{('fieldCommentRequirement', 'Required')},
Map{('publicMethodCommentRequirement', 'Required')},
Map{('protectedMethodCommentRequirement', 'Required')},
Map{('enumCommentRequirement', 'Required')},
Map{('serialVersionUIDCommentRequired', 'Ignored')},
Map{('serialPersistentFieldsCommentRequired', 'Ignored')}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment