Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7271

Codenarc parser doesn't parse AbcComplexity violations

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • violations-plugin
    • None

      The CodeNarc support added in JENKINS-7169 doesn't handle violations generated by the AbcComplexity rules; these contain a <Message> tag instead of a <SourceLine> tag inside the <Violations> tag. The first attached patch fixes this.

          [JENKINS-7271] Codenarc parser doesn't parse AbcComplexity violations

          roadrunner2 added a comment -

          With the first patch, the fact that the source and message fields of the Violation seem to be reversed becomes more obvious. Specifically, the source is set to the error-text of the codenarc violation and the message is set to the codenarc rule that failed; but since Violation.getSource() strips everything before last dot, and the AbcComplexity messages are of the form "
          The ABC score for method [foobar] is [92.0]", the result of getSource() is a useless "0]". Hence this second patch which reverses the source and message fields, which I think is semantically more correct.

          roadrunner2 added a comment - With the first patch, the fact that the source and message fields of the Violation seem to be reversed becomes more obvious. Specifically, the source is set to the error-text of the codenarc violation and the message is set to the codenarc rule that failed; but since Violation.getSource() strips everything before last dot, and the AbcComplexity messages are of the form " The ABC score for method [foobar] is [92.0] ", the result of getSource() is a useless "0]". Hence this second patch which reverses the source and message fields, which I think is semantically more correct.

          Hi,
          I can add these patches, but it may be easier if you got commit access and
          maintain it. Just drop an e-mail on the hudson dev mailing list.

          Peter

          peterkittreilly added a comment - Hi, I can add these patches, but it may be easier if you got commit access and maintain it. Just drop an e-mail on the hudson dev mailing list. Peter

          rbramley added a comment - - edited

          Good catch, my test bed project has the standard Grails rulesets configured ('rulesets/basic.xml,rulesets/exceptions.xml,rulesets/imports.xml,rulesets/grails.xml,rulesets/unused.xml') - had been planning to look at getting (standalone) GMetrics stats into Hudson this week.

          rbramley added a comment - - edited Good catch, my test bed project has the standard Grails rulesets configured ('rulesets/basic.xml,rulesets/exceptions.xml,rulesets/imports.xml,rulesets/grails.xml,rulesets/unused.xml') - had been planning to look at getting (standalone) GMetrics stats into Hudson this week.

          Code changed in hudson
          User: : peterkittreilly
          Path:
          trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/types/codenarc/CodenarcParser.java
          trunk/hudson/plugins/violations/src/test/java/hudson/plugins/violations/types/codenarc/CodenarcParserTest.java
          trunk/hudson/plugins/violations/src/test/resources/hudson/plugins/violations/types/codenarc/CodeNarcXmlReport.xml
          http://jenkins-ci.org/commit/35554
          Log:
          JENKINS-7271 patch for CodeArc parser does not parse AbcComplexity violations

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : peterkittreilly Path: trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/types/codenarc/CodenarcParser.java trunk/hudson/plugins/violations/src/test/java/hudson/plugins/violations/types/codenarc/CodenarcParserTest.java trunk/hudson/plugins/violations/src/test/resources/hudson/plugins/violations/types/codenarc/CodeNarcXmlReport.xml http://jenkins-ci.org/commit/35554 Log: JENKINS-7271 patch for CodeArc parser does not parse AbcComplexity violations

          bocytko added a comment -

          Fix available since Aug/2010

          bocytko added a comment - Fix available since Aug/2010

            peterkittreilly peterkittreilly
            roadrunner2 roadrunner2
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: