在 Jenkins 上使用带有警告插件和管道的 PyLint [英] Use PyLint on Jenkins with Warnings Plugin and Pipeline
本文介绍了在 Jenkins 上使用带有警告插件和管道的 PyLint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 PyLint/warnings-ng/" rel="noreferrer">警告插件 和 管道,因为 Violations 插件已被弃用.
I want to use PyLint on Jenkins with Warnings Plugin and Pipeline, since Violations plugin is deprecated.
没有文档或完整示例.
有一些资料:
timeout(time: 5, unit: 'MINUTES') {
sh 'npm run lint:ci'
step([$class: 'WarningsPublisher',
parserConfigurations: [[
parserName: 'JSLint',
pattern: 'pmd.xml'
]],
unstableTotalAll: '0',
usePreviousBuildAsReference: true
])
}
和解决方法:
pylint || exit 0
有更强大的解决方案吗?
Is there a more robust solution?
推荐答案
我已经成功了:
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
])
我仍然不确定如何配置它.
I'm still not sure how to configure it.
从 源代码和测试,这些可能是可能的参数,因为它们是构造函数参数:
From what I was able to read from the source code and tests, those might be the possible parameters because they are the constructor parameters:
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
- 用于扫描控制台的解析器
healthy
- Report health as 100% when the number of annotations is less than this valueunHealthy
- Report health as 0% when the number of annotations is greater than this valuethresholdLimit
- determines which warning priorities should be considered when evaluating the build stability and healthdefaultEncoding
- the default encoding to be used when reading and parsing filesuseDeltaValues
- determines whether the absolute annotations delta or the actual annotations set difference should be used to evaluate the build stabilityunstableTotalAll
- annotation thresholdunstableTotalHigh
- annotation thresholdunstableTotalNormal
- annotation thresholdunstableTotalLow
- annotation thresholdunstableNewAll
- annotation thresholdunstableNewHigh
- annotation thresholdunstableNewNormal
- annotation thresholdunstableNewLow
- annotation thresholdfailedTotalAll
- annotation thresholdfailedTotalHigh
- annotation thresholdfailedTotalNormal
- annotation thresholdfailedTotalLow
- annotation thresholdfailedNewAll
- annotation thresholdfailedNewHigh
- annotation thresholdfailedNewNormal
- annotation thresholdfailedNewLow
- annotation thresholdcanRunOnFailed
- determines whether the plug-in can run for failed builds, toousePreviousBuildAsReference
- determines whether to always use the previous build as the reference builduseStableBuildAsReference
- determines whether only stable builds should be used as reference builds or notcanComputeNew
- determines whether new warnings should be computed (with respect to baseline)shouldDetectModules
- determines whether module names should be derived from Maven POM or Ant build filesincludePattern
- Ant file-set pattern of files to include in reportexcludePattern
- Ant file-set pattern of files to exclude from reportcanResolveRelativePaths
- determines whether relative paths in warnings should be resolved using a time expensive operation that scans the whole workspace for matching files.parserConfigurations
- the parser configurations to scan filesconsoleParsers
- the parsers to scan the console
还有 parserConfigurations
javadoc 只说:
pattern
- 要解析的文件模式parserName
- 要使用的解析器的名称
pattern
- the pattern of files to parseparserName
- the name of the parser to use
其中列表解析器接缝在这里.
如果您有更多信息或需要更正的内容,请随时编辑或发表评论.
If you have more information or something needs correcting feel free to edit or drop a comment.
这篇关于在 Jenkins 上使用带有警告插件和管道的 PyLint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文