我想用PyLint https://www.pylint.org詹金斯与警告插件 https://plugins.jenkins.io/warnings-ng/ and Pipeline https://jenkins.io/doc/book/pipeline/,因为 Violations 插件已被弃用。
没有文档或完整的示例。
有一些信息 https://github.com/kitconcept/jenkins-pipeline-examples#static-code-analysis:
timeout(time: 5, unit: 'MINUTES') {
sh 'npm run lint:ci'
step([$class: 'WarningsPublisher',
parserConfigurations: [[
parserName: 'JSLint',
pattern: 'pmd.xml'
]],
unstableTotalAll: '0',
usePreviousBuildAsReference: true
])
}
and 解决方法 https://stackoverflow.com/questions/7347233/jenkins-with-pylint-gives-build-failure:
pylint || exit 0
有更稳健的解决方案吗?
我已经设法让它工作:
sh 'pylint --disable=W1202 --output-format=parseable --reports=no module > pylint.log || echo "pylint exited with $?")'
sh 'cat render/pylint.log'
step([
$class : 'WarningsPublisher',
parserConfigurations : [[
parserName: 'PYLint',
pattern : 'pylint.log'
]],
unstableTotalAll : '0',
usePreviousBuildAsReference: true
])
我仍然不确定如何配置它。
从我能读到的源代码 https://github.com/jenkinsci/warnings-plugin/blob/ee546a8f9de5dab58925e883c413d34659519696/src/main/java/hudson/plugins/warnings/WarningsPublisher.java#L145 and tests https://github.com/jenkinsci/warnings-plugin/blob/ee546a8f9de5dab58925e883c413d34659519696/src/test/java/hudson/plugins/warnings/WarningsWorkflowTest.java#L72,这些可能是可能的参数,因为它们是构造函数参数:
-
healthy
- 当注释数量小于该值时,报告健康状况为100%
-
unHealthy
- 当注释数量大于此值时,将运行状况报告为 0%
-
thresholdLimit
- 确定在评估构建稳定性和运行状况时应考虑哪些警告优先级
-
defaultEncoding
- 读取和解析文件时使用的默认编码
-
useDeltaValues
- 确定是否应使用绝对注释增量或实际注释集差异来评估构建稳定性
-
unstableTotalAll
- 注释阈值
-
unstableTotalHigh
- 注释阈值
-
unstableTotalNormal
- 注释阈值
-
unstableTotalLow
- 注释阈值
-
unstableNewAll
- 注释阈值
-
unstableNewHigh
- 注释阈值
-
unstableNewNormal
- 注释阈值
-
unstableNewLow
- 注释阈值
-
failedTotalAll
- 注释阈值
-
failedTotalHigh
- 注释阈值
-
failedTotalNormal
- 注释阈值
-
failedTotalLow
- 注释阈值
-
failedNewAll
- 注释阈值
-
failedNewHigh
- 注释阈值
-
failedNewNormal
- 注释阈值
-
failedNewLow
- 注释阈值
-
canRunOnFailed
- 确定插件是否也可以在失败的构建中运行
-
usePreviousBuildAsReference
- 确定是否始终使用以前的版本作为参考版本
-
useStableBuildAsReference
- 确定是否仅将稳定版本用作参考版本
-
canComputeNew
- 确定是否应计算新警告(相对于基线)
-
shouldDetectModules
- 确定模块名称是否应从 Maven POM 或 Ant 构建文件派生
-
includePattern
- Ant 文件集要包含在报告中的文件模式
-
excludePattern
- Ant 文件集要从报告中排除的文件模式
-
canResolveRelativePaths
- 确定是否应使用扫描整个工作区以查找匹配文件的耗时操作来解析警告中的相对路径。
-
parserConfigurations
- 扫描文件的解析器配置
-
consoleParsers
- 扫描控制台的解析器
And the parserConfigurations
javadoc https://github.com/jenkinsci/warnings-plugin/blob/master/src/main/java/hudson/plugins/warnings/ParserConfiguration.java#L37只说:
-
pattern
- 要解析的文件模式
-
parserName
- 要使用的解析器的名称
where 解析器列表位于此处 https://github.com/jenkinsci/warnings-plugin/tree/master/src/main/java/hudson/plugins/warnings/parser.
如果您有更多信息或需要更正某些内容,请随时编辑或发表评论。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)