1
votes

As the first step to my Azure DevOps pipeline I wish to validate my Python files by running pylint. This causes the pipeline to fail. My project is publicly available under this address:

https://dev.azure.com/gcr84/dark-matter-attractor

where all code is visible in the repo, and a pipeline run history is available. I would like to learn why the pylinting causes the pipeline to fail, and I have tried to add the command:

"|| pylint-exit $?"

(see https://pypi.org/project/pylint-exit/),

as well as

failOnStderr: false

(see https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/bash?view=azure-devops).

Below is my bash command:

- bash: find -name '*.py' | xargs pylint || pylint-exit $?
  displayName: 'Run pylint'
  failOnStderr: false
1
Have you enabled system diagnostics while running the pipeline? You can check the error with more verbose.MoonHorse
@MoonHorse I tried it, by manually running the pipeline. The results are: ##[debug]Exit code 1 received from tool '/bin/bash' ##[debug]STDIO streams have closed for tool '/bin/bash' ##[error]Bash exited with code '1'. Which I am not really sure how to progress fromGustav Rasmussen

1 Answers

1
votes

After check you logs, this seems to be an expect behavior which not related to Azure DevOps side.

  - fatal message issued

  - error message issued

  - refactor message issued

  - convention message issued

  - usage error

Fatal messages detected.  Failing...

This raised an error Exit code 1, finally fail the bash task.

With failOnStderr=false configured will only prevent this task fail with if any errors are written to stderr. Not all errors ignored.

If you do not want to deal with the error such as python-pylint 'C0103:Invalid constant name. A workaround should be adding continueOnError: true

- bash: find -name '*.py' | xargs pylint || pylint-exit $?
  displayName: 'Run pylint'
  failOnStderr: false
  continueOnError: true

This will force your build continue to run. Besides, you could also give a try with some 3rd party extension to run pylink such as-- PyLint Checker