How would I start integrating pyflakes with Hudson

随声附和 提交于 2019-12-22 04:12:30

问题


We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're doing it wrong."


回答1:


You can adapt pyflakes and pep8 output to work with the Violations pylint plugin.

pyflakes path/to/src | awk -F\: '{printf "%s:%s: [E]%s\n", $1, $2, $3}' > violations.pyflakes.txt

pep8 path/to/src | awk -F\: '{printf "%s:%s: [%s]%s\n", $1, $2, substr($4,2,4), substr($4,6)}' > violations.pep8.txt

You could use a regex or concatenate the output to generate a report that includes multiple metrics.

For more details see http://hustoknow.blogspot.com/2011/01/integration-pyflakes-into-hudson.html




回答2:


The Violations plugin requires xml output from the various checkers that it supports.

I'm not familiar with pyflakes, but from my brief scan, it doesn't appear to support xml as an output type. So you'll have to post-process the pyflakes output before letting Violations try to parse it (or you could modify pyflakes and write your own Message output class). You'll probably want to capture the pylint output and use that to figure out the appropriate xml format that the Violations plugin likes.




回答3:


The Violations plugin requires xml output from the various checkers

This is wrong: Some checkers like "checkstyle" output XML, some others like "pylint" and "pep8" output "text" files with one record per line. The heading in Jenkins "XML filename pattern" is plain misleading.



来源:https://stackoverflow.com/questions/2436787/how-would-i-start-integrating-pyflakes-with-hudson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!