使用jenkins仅对更改的行/文件运行pylint [英] Running pylint against only changed lines/files with jenkins
问题描述
这时,我正在Jenkins中使用违规插件,以生成关于PEP8违规的报告.由于我才刚刚开始使用此检查,因此有大量的违规行为.因此,我想首先检查一下拉取请求中发生了什么变化.
At this time, I am using the violations plugin with Jenkins to generate a report of PEP8 violations. Since I am only beginning to use this check, there are an insane number of violations. So I'd like to start with only checking what changed in a pull request.
打开请求请求时,我使用github请求请求构建器来测试请求请求,并且我还想使用pylint(或等效工具)检查样式.
When a pull request is opened, I use the github pull request builder in order to test the pull request, and I'd also like to check the styling using pylint (or equivalent) as well.
我使用此命令来为jenkins生成当前的pylint报告
I use this command in order to generate my current pylint report for jenkins
pylint -f parseable ‘/var/lib/ci_server/workspace/pylint_check’ | tee pylint.out
以上命令将扫描整个项目,而不仅仅是扫描请求中的更改.
The above command will scan the entire project rather than just changes in the pull request.
我也尝试过使用它:
git diff-index —name-only HEAD | grep .py | xargs pylint -f pylint -f parseable | tee pylint.out
^此命令运行构建,但对我的请求请求产生0违规...看起来我的请求请求显示在分离的HEAD某种状态下(我假设git diff在这种情况下不再起作用?)
^ This command runs the build, but yields 0 violations on my pull request... It looks like that my pull requests show up in a detached HEAD sort of state (I assume git diff no longer works in this context?)
这里的总体目标是使用Jenkins在请求请求的更改中扫描样式违规...我已经为此花了几天的时间.任何帮助都将非常棒,加油!
The overall goal here is to scan for style violations within changes in a pull request using Jenkins... I've been pulling my hair over this for a couple days now. Any help would be super great, cheers!
推荐答案
查看 git-lint
一个>.它似乎可以完成您想要完成的任务.
Check out git-lint
. It seems to do what you're looking to accomplish.
这篇关于使用jenkins仅对更改的行/文件运行pylint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!