Checkstyles and docker

已查看 33 次
跳至第一个未读帖子

l4n...@gmail.com

未读,
2017年5月19日 17:28:522017/5/19
收件人 checkstyle
Hi everyone. I am trying to improve my companies code quality. We want Jenkins to launch a docker container, pull in our Android code, run checkstyles, then block Jenkins if there were issues.

So far I have this working. Except the checkstyle jar seems to act oddly. Unlike my intellij plugin, it is listing everything as a warning, and not raising the exit code I want to see. It also doesn't stop the build process like I would like (secondary goal). Any ideas on what I can do to make checkstyles hault my docker and return an error code?

Thanks!

This is the line in my docker file that evokes checkstyle.jar

CMD java -jar ./styleguide/checkstyle-7.7-all.jar -c ./styleguide/checkstyle-master/src/main/resources/google_checks.xml .

Roman Ivanov

未读,
2017年5月19日 17:34:532017/5/19
收件人 l4n...@gmail.com、checkstyle
please make sure that severity is "error" in your config to have CLI return non 0 exit code

if still a problem - run it on local and make it work as you need, only when try launches in docker.

--
You received this message because you are subscribed to the Google Groups "checkstyle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to checkstyle+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim Shepherd

未读,
2017年5月19日 18:35:362017/5/19
收件人 Roman Ivanov、checkstyle
Good call on the warning flag. I couldn't believe there wasn't a command line flag for that. That said it is still a 0. BUT the output is much more nicer when thinking about doing some grep commands. 

Audit done.

Checkstyle ends with 118625 errors.

(Don't judge :-) we didn't do spacing like google. Next week I auto apply changes and adjust the output )

--
-Jim Shepherd

l4n...@gmail.com

未读,
2017年5月19日 20:42:162017/5/19
收件人 checkstyle、romani...@gmail.com
This is what I came up with. Will try to find a better solution later... As I have to have this command as the last command else it will get over ridden. If I had it earlier I would cut run time in half. But 3 vs 7 mins considering our tests take 40+ 

CMD java -jar ./styleguide/checkstyle-7.7-all.jar -c ./styleguide/rules/google_checks.xml . > ./result.txt | grep "Checkstyle ends with *" | sed "s/[^0-9]//g" | grep '[1-9]' && echo "Failed check styles" && (exit 1);


Roman Ivanov

未读,
2017年5月20日 00:45:382017/5/20
收件人 l4n...@gmail.com、checkstyle
Remove all javadoc checks and you will make significantly quicker. I recommend to have javadoc validation as separate launch if smb care about speed. Javadoc violations are usually not that critical.
回复全部
回复作者
转发
0 个新帖子