Commit c5d88c17 authored by Roxane Kang Maréchal's avatar Roxane Kang Maréchal
Browse files

Merge branch 'fix/770-CommentRequired'

parents 23a14433 3de9a9f3
...@@ -545,7 +545,7 @@ rule MeasureCommentContent(element: Sequence(String)){ ...@@ -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)) { rule MeasureCommentRequired(element: java!BodyDeclaration, violatedProperties: Set(String)) {
to to
om: smm!ObservedMeasure ( om: smm!ObservedMeasure (
......
...@@ -2,7 +2,7 @@ library documentation; ...@@ -2,7 +2,7 @@ library documentation;
--------------------------------------------- CommentRequired --------------------------------------------- --------------------------------------------- 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) = helper def: commentRequired() : Set(smm!Measure) =
java!BodyDeclaration.allInstances() java!BodyDeclaration.allInstances()
...@@ -15,7 +15,7 @@ helper def: commentRequired() : Set(smm!Measure) = ...@@ -15,7 +15,7 @@ helper def: commentRequired() : Set(smm!Measure) =
-> collect (elem | thisModule.MeasureCommentRequired(elem, thisModule.violatedCommentRequiredProperties(elem))) -> collect (elem | thisModule.MeasureCommentRequired(elem, thisModule.violatedCommentRequiredProperties(elem)))
; ;
--- Returns true if the given elem violates any of the CommentRequired rule properties --- Returns true if there exists a CommentRequired property denoting that the given element requires a comment but does not have any
helper def: violatesCommentRequired(elem: java!BodyDeclaration): Boolean = helper def: violatesCommentRequired(elem: java!BodyDeclaration): Boolean =
-- An element violates a property if there's at least one that's violated, -- 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 = ...@@ -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 = 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 -- 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 ...@@ -40,7 +40,7 @@ helper def: violatedCommentRequiredProperties(elem: java!BodyDeclaration): Strin
->collect(tuple | propertyNames.concat(tuple.property)) ->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 element, false otherwise
helper def: matchesCommentRequiredProperty( helper def: matchesCommentRequiredProperty(
value:String, -- is either 'Required' or 'Ignore' value:String, -- is either 'Required' or 'Ignore'
elem: java!BodyDeclaration, elem: java!BodyDeclaration,
...@@ -74,7 +74,7 @@ helper def: hasComments(elem: java!BodyDeclaration): Boolean = ...@@ -74,7 +74,7 @@ helper def: hasComments(elem: java!BodyDeclaration): Boolean =
not elem.comments.isEmpty() not elem.comments.isEmpty()
; ;
--- Contains the default configuration for the CommentRequired rule --- Defines 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 -- Can add, delete or modify properties here to customize them just like in PMD
helper def: commentRequiredPropertyDefinitions() : helper def: commentRequiredPropertyDefinitions() :
Map( Map(
......
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