首页 > 解决方案 > pylint 或 flake8 的声明性 Jenkins 管道语法

问题描述

有人可以帮助我使用 Violation 插件的声明性语法或用于 pylint 的警告下一代插件吗

我正在使用以下语法。但它没有生成任何图表

sh 'python3 -m pylint --fail-under=4.5 <module> <module> --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint.log || echo "pylint exited with $?"'

echo "linting Success, Generating Report"

warningsParsers canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: '*']], unHealthy: ''

标签: pythonjenkinspylint

解决方案


我使用以下语法来解决问题

sh 'python3 -m pylint --output-format=parseable --fail-under=<threshold value> module --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" | tee pylint.log || echo "pylint exited with $?"'
echo "linting Success, Generating Report"
recordIssues enabledForFailure: true, aggregatingResults: true, tool: pyLint(pattern: 'pylint.log')

推荐阅读