Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
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
c5d88c17
Commit
c5d88c17
authored
Dec 22, 2019
by
Roxane Kang Maréchal
Browse files
Merge branch 'fix/770-CommentRequired'
parents
23a14433
3de9a9f3
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/atl/analysis.atl
View file @
c5d88c17
...
...
@@ -545,7 +545,7 @@ rule MeasureCommentContent(element: Sequence(String)){
}
}
--- Creates a measure instance
for each element that violates the rule : CommentRequired
--- Creates a
new
measure instance
when comments are required but are not present on specific language elements
rule MeasureCommentRequired(element: java!BodyDeclaration, violatedProperties: Set(String)) {
to
om: smm!ObservedMeasure (
...
...
src/main/atl/documentation.atl
View file @
c5d88c17
...
...
@@ -2,7 +2,7 @@ library documentation;
--------------------------------------------- CommentRequired ---------------------------------------------
--- Returns a set of measures for each element
that violates the rule : CommentRequired
--- Returns a set of measures for each element
where comments are required but are missing
helper def: commentRequired() : Set(smm!Measure) =
java!BodyDeclaration.allInstances()
...
...
@@ -15,7 +15,7 @@ helper def: commentRequired() : Set(smm!Measure) =
-> collect (elem | thisModule.MeasureCommentRequired(elem, thisModule.violatedCommentRequiredProperties(elem)))
;
--- Returns true if the
given elem violates any of the
CommentRequired
rule
propert
ies
--- Returns true if the
re exists a
CommentRequired propert
y denoting that the given element requires a comment but does not have any
helper def: violatesCommentRequired(elem: java!BodyDeclaration): Boolean =
-- An element violates a property if there's at least one that's violated,
...
...
@@ -29,7 +29,7 @@ helper def: violatesCommentRequired(elem: java!BodyDeclaration): Boolean =
)
;
--- Returns the list of
violated
CommentRequired properties
as a string
--- Returns
as a string,
the list of CommentRequired properties
(comments required but missing) that the given element violates
helper def: violatedCommentRequiredProperties(elem: java!BodyDeclaration): String =
-- Get the set of property tuples associated to elem by using elem data type as key to the Map
...
...
@@ -40,7 +40,7 @@ helper def: violatedCommentRequiredProperties(elem: java!BodyDeclaration): Strin
->collect(tuple | propertyNames.concat(tuple.property))
;
--- Returns true if the
given
property tuple applies to the given elem, false otherwise
--- Returns true if the
CommentRequired
property tuple applies to the given elem
ent
, false otherwise
helper def: matchesCommentRequiredProperty(
value:String, -- is either 'Required' or 'Ignore'
elem: java!BodyDeclaration,
...
...
@@ -74,7 +74,7 @@ helper def: hasComments(elem: java!BodyDeclaration): Boolean =
not elem.comments.isEmpty()
;
---
Conta
ins
the default configuration for the CommentRequired rule
---
Def
in
e
s
properties denoting whether comments are required (or unwanted) for specific language elements
-- Can add, delete or modify properties here to customize them just like in PMD
helper def: commentRequiredPropertyDefinitions() :
Map(
...
...
Write
Preview
Supports
Markdown
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