Saturday, 15 May 2010

java - Checkstyle and Jenkins: check modified/added lines in SVN commit -



java - Checkstyle and Jenkins: check modified/added lines in SVN commit -

we have big-old java project lot of legacy code. have code conventions , checkstyle rules check it.

we want configure jenkins job, runs after every commit svn, check, if modified/added lines not violate our checkstyle rule.

it's not alternative check whole project, because of legacy code. can't reformat code, because hard determine changed particular line , why.

the approach consider - create diff between previous , current checkstyle report, , see, if there new violations.

the question - how can access previous checkstyle study in jenkins?

or how configure checkstyle fail build if there new violations?

and may there ready-made solutions such check?

this bit round-about, if set sonar instance analyze project, can query violations info programmatically through it's remote access api. know violations count in legacy code (presumably, number won't alter frequently). that's baseline - don't want count go higher that.

so within ci job, add together script @ end calls sonar count of violations @ each of severity levels care (blocker, critical, etc), , fail build if current count exceeds threshold/benchmark.

sonar pretty awesome overall, projects lots of legacy code, 'cuz can drill downwards , figure out riskiest areas are. they've got public instance running if haven't checked out yet.

java svn jenkins checkstyle

No comments:

Post a Comment