1

My objective: I want pylint (in combination with pre-commit hooks) not to fail with warnings of the category C,R,W, but on E,F (Errors and fatals) and still output the warnings.

I found a corresponding flag "--fail-on" on pylints-webpage but it didnt work. My pre-commit config looked like:

- repo: local
  hooks:
    - id: pylint
      name: pylint
      entry: py -m pylint
      language: system
      types: [python]
      args: [--fail-on=E]

but the pre-commit still fails on warnings. Right now, I disabled the categories C,R,W to pass the pre-commit hooks, but this results in not showing me any warnings anymore.

Question: How can I achieve my upper objective?

anthony sottile
  • 61,815
  • 15
  • 148
  • 207
horsti
  • 113
  • 1
  • 7

1 Answers1

0

You need to use the combination --exit-zero and --fail-on=F,E.

Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48
  • This doesnt work. Using args: [--errors-only] does then not showing any warnings anymore, which was part of my objective (Fail only on errors/fatals but also print the warnings) – horsti Oct 08 '22 at 13:11
  • That still doesnt work. It passes the tests (only fails on F/E), but supresses any warnings. – horsti Oct 08 '22 at 14:19
  • Then it's impossible to do, please comment on https://github.com/PyCQA/pylint/issues/2293 – Pierre.Sassoulas Oct 08 '22 at 15:24