• Icon: Patch Patch
    • Resolution: Fixed
    • Icon: Minor Minor
    • violations-plugin
    • None

      CodeNarc provides a static analysis tool and framework for analysing Groovy source code.

      CodeNarc scans Groovy source code, looking for violations of predefined or custom rules and generates an HTML or XML report of the results. These rules include checks for coding standards, or searching for unused code, possible bugs or bad coding practices.

      The patch parses the CodeNarc (0.9) XML report and maps Codenarc violations to Hudson violations.

          [JENKINS-7169] Add Codenarc support to Violations plugin

          roadrunner2 added a comment -

          I saw from your tweet http://twitter.com/rbramley/status/20900146041 that you had trouble attaching the patch - did you try zip'ing it up first? Or maybe you could put it on something like http://pastebin.com/ ? Basically I guess what I'm saying is that I'd be quite interested in your patch .

          roadrunner2 added a comment - I saw from your tweet http://twitter.com/rbramley/status/20900146041 that you had trouble attaching the patch - did you try zip'ing it up first? Or maybe you could put it on something like http://pastebin.com/ ? Basically I guess what I'm saying is that I'd be quite interested in your patch .

          rbramley added a comment -

          Here's the patch (my Jira permissions seem to have been sorted).

          There are 2 TODOs in the code (the first has a workaround, the second is an improvement):

          1. You can't always see the violation in the context of the file (this happens when the file attribute in the file element of filename.xml has an incorrect path) - the workaround is to use the Faux project path.

          2. The popup message shows the Codenarc rule name; there is some commented out code to set this to the rule description instead (but this is based on a patch to Codenarc that I am discussing with the Codenarc maintainer). An alternative would be to pull the rules into a map and re-process the Hudson violation instances.

          rbramley added a comment - Here's the patch (my Jira permissions seem to have been sorted). There are 2 TODOs in the code (the first has a workaround, the second is an improvement): 1. You can't always see the violation in the context of the file (this happens when the file attribute in the file element of filename .xml has an incorrect path) - the workaround is to use the Faux project path. 2. The popup message shows the Codenarc rule name; there is some commented out code to set this to the rule description instead (but this is based on a patch to Codenarc that I am discussing with the Codenarc maintainer). An alternative would be to pull the rules into a map and re-process the Hudson violation instances.

          Code changed in hudson
          User: : peterkittreilly
          Path:
          trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/TypeDescriptor.java
          trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/types/codenarc/CodenarcDescriptor.java
          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/34010
          Log:
          JENKINS-7169: patch to add narc violations patch from Robin Bramley

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : peterkittreilly Path: trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/TypeDescriptor.java trunk/hudson/plugins/violations/src/main/java/hudson/plugins/violations/types/codenarc/CodenarcDescriptor.java 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/34010 Log: JENKINS-7169 : patch to add narc violations patch from Robin Bramley

          roadrunner2 added a comment -

          Thanks for the patch! After fixing a couple issues (see JENKINS-7271) this is working quite well for me.

          roadrunner2 added a comment - Thanks for the patch! After fixing a couple issues (see JENKINS-7271 ) this is working quite well for me.

          bocytko added a comment -

          This issue has been fixed since Aug 2010 and it works well with violations plugin (trunk), jenkins 1.405-1.407 and CodeNarc 0.13 (current).

          bocytko added a comment - This issue has been fixed since Aug 2010 and it works well with violations plugin (trunk), jenkins 1.405-1.407 and CodeNarc 0.13 (current).

            peterkittreilly peterkittreilly
            rbramley rbramley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: