Closed (fixed)
Project:
Coder
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jul 2010 at 13:27 UTC
Updated:
9 Sep 2011 at 05:44 UTC
Jump to comment: Most recent file
Comments
Comment #1
zroger commentedHere is a patch that adds an additional drush command to output coder results in the checkstyle xml format. Checkstyle is a java utility for evaluating different coding standards, particularly targeted at java files. This utility is widely integrated into IDE's and CI environments, so using this output format makes a lot of sense.
Using the Hudson violations plugin with the output from this drush command, I am able to get really useful charts of coding standard violations, and even see the offending code in the browser. http://skitch.com/zroger/d3gea/hudson
About the new drush command... I wrote this as a separate command because the current command is tightly integrated with the main module code. I based the new command off of the coder test cases, since that method provides access to the results arrays rather than the formatted output.
Comment #2
moshe weitzman commentedWow, this is awesome. Watching a demo now. Thanks Tree House.
Comment #3
rapsli commentedreally cool. Patch works just fine.
Just haven't figured out yet, how to make the reports :( I'm not too familiar with maven and co
Comment #4
jsobiecki commentedHi, This patch is very cool and works for me.
I think that one small addition to this patch would be helpful: possibility of specifying comma separated list of projects. I attached slighty modified version of this patch with this feature added.
Comment #5
dixon_subscribing.
Comment #6
zroger commentedHere's a matching d7 patch for good measure ;)
Comment #7
Steven Merrill commented... and the D7 patch needs a little more love, which is forthcoming shortly.
Comment #8
rapsli commentedis this getting into the module?
Comment #9
rapsli commented@zroger I'm not quite sure how to use the options. Would you mind posting an example call using the options?
Comment #10
JvE commentedIn the [#4] patch ".module" files are ignored.
The latest checkstyle_plugin for Jenkins (3.14) ignores "minor", "normal" and "critical" severity.
it expects "info", "warning" and "error".
I also had to add a callback to the $info before it worked at all in drush 4.
My 1st attempt at a patch tries to solve these.
Comment #11
JvE commentedOh shoot. that file is no good.
attempt nr2..
Comment #12
JvE commentedComment #13
royjs commentedSeems to be an error in the patch
I think that line
Should be
Else the --severity argument is ignored
Comment #14
royjs commentedI'm using the output of the coder-checkstyle command in Jenkins and except a small problem that I noted in #13 it works for me so far.
Comment #15
cyberwolf commentedSubscribing
Comment #16
stella commentedI'd like to see this added to coder, but not as a "coder-checkstyle" command. The option for xml output should be added to the existing "coder-review" command which supports additional options and can review patch files too.
Comment #17
stella commentedI added a modified version of this to the Drupal 7 version which adds support for xml output to the existing
drush coder-reviewcommand.I just need to backport it to Drupal 6.
Comment #18
royjs commentedI think it's a good idea to add it as an option for the coder-review command
Comment #19
pwolanin commentedIf only java tools took JSON more readily...
Comment #20
stella commentedCommitted to 6.x-2.x
Comment #21
kasperg commentedIs it the intent that this feature should output a general XML file or a Checkstyle XML report?
If the latter is the case I've found several differences when trying to integrate Coder Review into our Jenkins CI process with Checkstyle plugins:
Whether or not these differences are actual errors depends on how you see it. I have not found any official Checkstyle report schema to validate the Coder Review XML output against. On the other hand other tools such as Jenkins and PHP_Codesniffer are clearly working with a different format than Coder Review.
Comment #22
JvE commentedYeah, I noticed this too.
It's nice that there is xml output now, but it's useless for integration with jenkins & checkstyle
I'm using the attached patch in combination with the 7.x-1.0-beta6 release. My jenkins "coder" build step:
Comment #23
kasperg commentedI use the 7.x-1.x release with patches here and here.
The build is orchestrated using Phing, the Drush task and filterchains to modify the Coder Review XML output as mentioned in #21.
Comment #25
stella commentedAdded in checkstyle option too in latest dev, both 6.x and 7.x versions.
Comment #26
royjs commentedThe new checkstyle option works as expected and the files are valid in jenkins.
My problem is that I have some errors missing the message when using both the xml and the checkstyle options.
The error xml tag has a message property but its value is simply ""
Does anyone else have that problem ?
Comment #27
royjs commentedThe parameter "warning" received in function "theme_drush_coder_warning" of file coder.drush.inc doesn't seem to always be the same. Sometimes $warning is a string and contains the message and sometimes it is an array and the message is in $warning['#warning']
Comment #28
patcon commentedJust wanted to say thanks to everyone who got this in. It's a rockin feature :)
Comment #29
patcon commented[doublepost]