在 Jenkins 上使用带有警告插件和管道的 PyLint [英] Use PyLint on Jenkins with Warnings Plugin and Pipeline

查看:28
本文介绍了在 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 value
  • unHealthy - Report health as 0% when the number of annotations is greater than this value
  • thresholdLimit - determines which warning priorities should be considered when evaluating the build stability and health
  • defaultEncoding - the default encoding to be used when reading and parsing files
  • useDeltaValues - determines whether the absolute annotations delta or the actual annotations set difference should be used to evaluate the build stability
  • unstableTotalAll - annotation threshold
  • unstableTotalHigh - annotation threshold
  • unstableTotalNormal - annotation threshold
  • unstableTotalLow - annotation threshold
  • unstableNewAll - annotation threshold
  • unstableNewHigh - annotation threshold
  • unstableNewNormal - annotation threshold
  • unstableNewLow - annotation threshold
  • failedTotalAll - annotation threshold
  • failedTotalHigh - annotation threshold
  • failedTotalNormal - annotation threshold
  • failedTotalLow - annotation threshold
  • failedNewAll - annotation threshold
  • failedNewHigh - annotation threshold
  • failedNewNormal - annotation threshold
  • failedNewLow - annotation threshold
  • canRunOnFailed - determines whether the plug-in can run for failed builds, too
  • usePreviousBuildAsReference - determines whether to always use the previous build as the reference build
  • useStableBuildAsReference - determines whether only stable builds should be used as reference builds or not
  • canComputeNew - 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 files
  • includePattern - Ant file-set pattern of files to include in report
  • excludePattern - Ant file-set pattern of files to exclude from report
  • canResolveRelativePaths - 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 files
  • consoleParsers - the parsers to scan the console

还有 parserConfigurations javadoc 只说:

  • pattern - 要解析的文件模式
  • parserName - 要使用的解析器的名称
  • pattern - the pattern of files to parse
  • parserName - 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆