在 jenkinsfile 中运行 pylint 和 pycodestyle

问题描述 投票:0回答:0

我有一个 git 存储库,里面有一些 python 文件。我想在 jenkins 管道中根据 python 的 pylint 和 pycodestyle 标准检查这些文件。我要运行的节点是windows环境。我写了下面的代码。

   stage('Check file for pylint'){
            powershell"""
            .\\venv\\Scripts\\Activate.ps1
            ${WORKSPACE}\\code_analyzer\\check_pylint.bat | tee pylint.log
            """
            pylint = scanForIssues blameDisabled: true, tool: pyLint(pattern: 'pylint.log')

        }
        stage('Check files for pycodestyle'){
        powershell"""
        .\\venv\\Scripts\\Activate.ps1
        ${WORKSPACE}\\code_analyzer\\check_pycodestyle.bat 2>&1 | tee pycodestyle.log
        """
        pycodestyle = scanForIssues blameDisabled: true, tool: pep8(pattern: 'pycodestyle.log')
        }
    }

这是否正确且充分,还是我需要在文件中添加另一个阶段,例如分析?

powershell jenkins jenkins-pipeline pylint
© www.soinside.com 2019 - 2024. All rights reserved.