qpscanner icon indicating copy to clipboard operation
qpscanner copied to clipboard

create jenkins - warning plugin parser

Open mhenke opened this issue 13 years ago • 7 comments

https://wiki.jenkins-ci.org/display/JENKINS/Warnings+Plugin

Defining a new parser using the user interface

Since release 3.8 you can define new parsers dynamically in the system configuration section of Jenkins. Just navigate to http://[jenkins-url]/configure and create a new parser in section Compiler Warnings. The UI should be self explanatory, if there is something missing, please let me know on the mailing lists. Writing a new parser that should be included in the warnings plug-in

Extending the existing set of supported warning formats is quite easy. If the format of the warnings messages could be parsed by an regular expression, then you only need to provide a new parser class and a corresponding test case:

  1. Set up your developing environment as described in the Plugin tutorial
  2. Clone the warnings plug-in from GitHub
  3. Run maven with the command mvn install to see if the plug-in builds before you change anything
  4. Add a new class YourFormatParser to the package hudson.plugins.warnings, see GccParser or JavacParser as examples
  5. Add a new test case YourFormatParserTest to the package hudson.plugins.warnings, see GccParserTest or JavacParserTest as examples.
  6. Register the new parser in the method getAllParsers() of the registry ParserRegistry
  7. Send a pull request to get your changes integrated

mhenke avatar Jan 24 '12 19:01 mhenke

Not clear on the issue here - I haven't used Jenkins, so it all makes less sense than it might otherwise.

Is it basically asking for a more integrated way to pass results from qpscanner to Jenkins, to allow the details of any unparamed variables to be explored through a Jenkins dashboard/ui?

boughtonp avatar Jan 25 '12 17:01 boughtonp

Yes. Most inspection tools create an xml file Jenkins reads and uses for graphs & other integration.

mhenke avatar Jan 25 '12 18:01 mhenke

here is a snippet from the jslint inspection xml file created:

< jslint> < file name="\xxx\servers\xxx\cfusion.ear\cfusion.war\tests\inspection\Buttons.js"> < issue line="1" char="9" reason="Expected 'var' at column 1, not column 9." evidence=" var NN3 = false;"/> < issue line="2" char="1" reason="Unexpected '(space)'." evidence=" "/> < issue line="3" char="9" reason="Expected 'rqaddr' at column 1, not column 9." evidence=" rqaddr=new Image();"/> < /file> ....

mhenke avatar Jan 25 '12 19:01 mhenke

here are some inspections I created for cfml projects https://github.com/mhenke/Cloudy-With-A-Chance-Of-Tests

here are screenshots of the results in jenkins http://henke.ws/post.cfm/cloudy-with-a-chance-of-tests-screenshots

mhenke avatar Jan 25 '12 19:01 mhenke

it is an easy 7 steps as described above, lol :-)

mhenke avatar Jan 25 '12 19:01 mhenke

Yep, starting to make sense now.

What's the difference between a "warning" and a "violation" - the jslint thing seems to be the latter, but I don't see why there's two different things?

boughtonp avatar Jan 25 '12 19:01 boughtonp

They are different plugins for jenkins. qpscanner might fit better as a violation but I don't see an easy way to add a new voilation type. Guess if we want it done correctly, it might go into violations.

https://wiki.jenkins-ci.org/display/JENKINS/Violations https://wiki.jenkins-ci.org/display/JENKINS/Warnings+Plugin

mhenke avatar Jan 25 '12 20:01 mhenke