Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--zero-exit on CI and pre-commit gives false negative #594

Open
abelsiqueira opened this issue Feb 20, 2023 · 0 comments
Open

--zero-exit on CI and pre-commit gives false negative #594

abelsiqueira opened this issue Feb 20, 2023 · 0 comments

Comments

@abelsiqueira
Copy link

cc @sjvrijn @luisaforozco which helped track this down

Description

I noticed that both the CI [1] and the pre-commit [2] use --zero-exit. But --zero-exit is telling prospector to ignore the issues it found, since the flag check [3] is run before the length of the messages check [4].

I think that defeats the purpose of having it on the CI and pre-commit.
As an example, I ran prospector on this repo and got 24 issues.[5]

[1] https://github.com/PyCQA/prospector/blob/197622ef559b2056c7d3fa486be84d9251026be7/.github/workflows/tests.yml#L31

[2] https://github.com/PyCQA/prospector/blob/197622ef559b2056c7d3fa486be84d9251026be7/.pre-commit-config.yaml#L42

[3] https://github.com/PyCQA/prospector/blob/866b79ed7aa381266939bcac952df40993dbfad3/prospector/run.py#L201-L204

[4]
https://github.com/PyCQA/prospector/blob/866b79ed7aa381266939bcac952df40993dbfad3/prospector/run.py#L209-L211

[5]

$ poetry run prospector
...
=================
         Started: 2023-02-20 15:42:43.808330
        Finished: 2023-02-20 15:42:53.087899
      Time Taken: 9.28 seconds
       Formatter: grouped
        Profiles: .prospector.yml, no_doc_warnings, no_member_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh
      Strictness: from profile
  Libraries Used: 
       Tools Run: dodgy, mypy, profile-validator, pycodestyle, pyflakes, pylint
  Messages Found: 24
 External Config: pylint: ####/prospector/pyproject.toml

Expected result

  • Expected prospector to return 0 issues on prospector.
  • Maybe change flag to --ignore-errors to make the purpose clearer.

Environment (please complete the following information):

  • OS: linux
  • poetry run prospector
  • Version 1.9.1
  • Python 3.9.16

Additional context

I was trying to change from a manual .githooks/pre-commit configuration to pre-commit (https://pre-commit.com). The project passes prospector but was failing pre-commit run -a (with pylint: import-error / Unable to import). I was looking through other pre-commit configs trying to fix it and noticed that the zero-exit flag could lead to errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant