longyiqi/oclint — Issue #14: For Rules With Parameters, Violation message should include the limit and the Count 
Author: ghorvath
Created: 2012-02-03 19:43:11+00:00
State: open

i.e. for the cyclomatic complexity rule, the message emitted should say not just the name of the rule, but also say something like

(Value XX exceeded limit of YY)

Where XX is, for instance, the cyclomatic complexity of the method which is in violation, and YY is the limit for reporting a violation.

The rationale for this is for prioritization of work; if I have 20 violations of the cyclomatic complexity rule, I shouldn't have to look at all 20 to figure out which are the worst offenders. The tool should tell me this in the report.

An easy implementation appears to be:

1) Add a name member on class Rule
2) Provide a single implementation of the name() method in the Rule class
3) Instead of re-defining the name() method for each concrete subclass of Rule, simply have each class set the name member. Rules that are parameterized would then just append the additional information to the name member if a violation was found.