我设置了一个Jenkins CI服务器,用于使用rubocop分析ruby代码,然后在github上的pull请求中发布违规。
我有PEP8工作,但也想发表评论给github ...有没有任何程序可能会像pronto-rubocop那样做的伎俩?
UPDATE1:
我正在尝试使用Jenkins构建脚本(Execute Shell)中的以下命令,使用Ubuntu中的pep8实用程序将我的Jenkins服务器配置为扫描我的项目:
pep8 testing/ > pep8.out
接下来,我使用违规插件并在XML文件名模式下输入“pep8.out”。这非常适合为我的整个项目提供结果......
但是,我想仅扫描针对样式违规的拉取请求中的更改,因此我使用对GitHub插件的违规注释来执行此任务。
当我使用github pull request builder插件时,我输入了这个作为我的Pull Request ID:
${ghprbPullId}
接下来,我检查“仅注释已更改文件的一部分”框,并将“pep8.out”作为我的模式放在“FLAKE8”选项旁边。据我所知,PEP8和FLAKE8应该是交叉兼容的。
有大量的违规行为应该是开箱即用的(例如,我使用2个空格而不是4个用于python3)。这应该在我的样本拉取请求中被标记。但我在控制台中看到以下输出:
---
--- Jenkins Violation Comments to GitHub ---
---
pullRequestId: 83
usernamePasswordCredentialsId: false
username: false
password: false
createSingleFileComments: false
createCommentWithAllSingleFileComments: true
commentOnlyChangedContent: true
CHECKSTYLE with pattern
CSSLINT with pattern
LINT with pattern pylint.out
FINDBUGS with pattern
JSHINT with pattern
PMD with pattern
CPPCHECK with pattern
RESHARPER with pattern
FLAKE8 with pattern ./pep8.out
CPPLINT with pattern
XMLLINT with pattern
PERLCRITIC with pattern
PITEST with pattern
ANDROIDLINT with pattern
Running Jenkins Violation Comments To GitHub
Will comment 83
Workspace: /var/lib/jenkins/workspace/Project Style Checks
Found 0 violations from ViolationConfig [pattern=./pep8.out, reporter=FLAKE8].
(我删除了任何可能的私人文本,但这应该让我对我所看到的内容有所了解)
当我深入挖掘日志时,我也发现了这个错误。 TBH不确定它是否相关:
java.lang.NullPointerException: GitHubUrl
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
at se.bjurr.violations.comments.github.lib.ViolationCommentsToGitHubApi.checkState(ViolationCommentsToGitHubApi.java:170)
at se.bjurr.violations.comments.github.lib.ViolationCommentsToGitHubApi.toPullRequest(ViolationCommentsToGitHubApi.java:155)
at org.jenkinsci.plugins.jvctg.perform.JvctgPerformer.doPerform(JvctgPerformer.java:103)
at org.jenkinsci.plugins.jvctg.perform.JvctgPerformer$1.invoke(JvctgPerformer.java:138)
at org.jenkinsci.plugins.jvctg.perform.JvctgPerformer$1.invoke(JvctgPerformer.java:125)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at org.jenkinsci.plugins.jvctg.perform.JvctgPerformer.jvctsPerform(JvctgPerformer.java:125)
at org.jenkinsci.plugins.jvctg.ViolationsToGitHubRecorder.perform(ViolationsToGitHubRecorder.java:60)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)