Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#235 New Feature : Scoring violation by its severity and size of violation,

Unstable_(example)
wont-fix
nobody
None
1
2013-10-29
2012-12-26
kazuro fukuhara
No

Dear Oliver Burn and all developers.

I wrote a patch to evaluate the violation with its size of violation.
At present, we can use severity 'info', 'warning', 'error' to evaluate violation.
But more detailed evaluation is needed to represent severity for the case below.

Case 1. The number of line of java source code is 2001.
Case 2. The number of line of java source code is 2501.
Case 3. The number of line of java source code is 3000.
Case 4. The number of line of java source code is 5000.

For all case, Checkstyle5.6 in FileLengthCheck will say they are all 'error'.
But Case 1 should be treated as slight and Case 5 should be treated as serious one.

With this patch, user can get score for each violation as its severity
(info = 2, warning = 5, error = 17) and size of violation if the check is one of below

NestedForDepth
NestedIfDepth
NestedTryDepth
MultipleStringLiterals
ClassDataAbstractionCoupling
ClassFanOutComplexity
BooleanExpressionComplexity
JavaNCSS
AnonInnerLength
ExecutableStatementCount
FileLength
LineLength
MethodCount
MethodLength
OuterTypeNumber
ParameterNumber

or square of size of violation if the check is CyclomaticComplexity.
(I believe this is one of the most important check all other check.
This violation should be reported as seriously.)

User can configure severity score such as info = 5, warning = 11, as default
setting for all check or configure for each check.
User can configure the logic to calculate score for each check such as
'severity', 'size of violation', 'square of size of violation'
User can also configure designed score for each check.

I attached zip file which have mychanges.patch via 'hg diff > mychanges.patch'
and Scoring.java. this java file is new one and should be copied under
\src\checkstyle\com\puppycrawl\tools\checkstyle\api .

Best Regards,
Kazuro Fukuhara

P.S.
I choose 2, 5, 17 as default score for each severity.
Because those number should be prime number and I like it! :)

1 Attachments

Discussion


  • Anonymous
    2012-12-26

    Dear Oliver Burn and all developers.

    Sorry, There is small mistake.
    Can you please check this one?

    ScoreFeature.fixed.zip

    Best Regards,
    Kazuro Fukuhara

     
  • Dear Oliver Burn and all developers.

    Sorry , There is small mistake.
    Can you please check this one?

    ScoreFeature.fixed.zip

    Best Regards,
    Fukuhara

     
  • Dear Oliver Burn and all developers.

    I published patch applied Checkstyle binary at the url below.
    And I wrote some document for this feature.

    http://www7b.biglobe.ne.jp/~archer/checkstyle/scorefeature.en.html

    Please test this feature and consider to marge this patch.
    If there is any problem about this patch, I'll fix this and update again.

    Best Regards,
    Fukuhara

     
  • Idea is interesting for some separate checks, but I don`t think that all people (including developers of IDE Checkstyle extensions) will perceive well such changes if they will be applied to main project.

     
    Last edit: Daniil Yaroslavtsev 2013-10-29
    • status: open --> wont-fix