Handle non-zero outputs as acceptable results

Hello, I wanted to add linting to my pipeline, so I added pylint as a stage:

  stage: test
    - python -m pylint <folders to consume>

However pylint returns 0 only if nothing is there to be reported. I have several #todo items in my code, which appear as warnings. pylint reports a summary of its findings with bit flags, and I would like to allow some refactor, warning and convention reports to be present and the build still be considered successfull. Is there a workaround for that?

1 Like

Any luck on this? We would also like to implement some sort of linting report in our gitlab-ci.

I ended upwith the following snippet:

  stage: test
    - bash -c 'python -m pylint module_root; if (( ($? & 3)>0 )); then exit 1; fi; exit 0'
    - bash -c 'python -m pylint -d C0111 test; if (( ($? & 3)>0 )); then exit 1; fi; exit 0' 
  allow_failure: true

I hope this helps, however it needs bash.