Skip to content

Remove Prospector --zero-exit argument#754

Merged
Pierre-Sassoulas merged 2 commits intomasterfrom
rm-exit-zero
Apr 11, 2025
Merged

Remove Prospector --zero-exit argument#754
Pierre-Sassoulas merged 2 commits intomasterfrom
rm-exit-zero

Conversation

@sbrunner
Copy link
Copy Markdown
Member

@sbrunner sbrunner commented Apr 10, 2025

Description

Remove the --zero-exit Prospector argument.

Complete the “exclude” to make the check pass.

@sbrunner sbrunner requested a review from Copilot April 10, 2025 14:25
@sbrunner sbrunner marked this pull request as ready for review April 10, 2025 14:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

.pre-commit-config.yaml:70

  • The new exclusion pattern 'tests/.*' is very broad and may inadvertently exclude files that should be checked. Consider refining the regex to only target the specific test files or directories that need to be excluded.
+            tests/.*

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

.pre-commit-config.yaml:69

  • The updated exclude pattern 'tests/.*' may be too broad and could inadvertently exclude files beyond the intended targets. Consider narrowing the regex to only the specific directories or file patterns you wish to exclude.
tests/.*

exclude: |-
(?x)^(
tests/suppression/testdata/.*
|tests/tools/vulture/testpath/testfile\.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting test files would bring value, how many should be fixed before this work at the moment ?

@sbrunner
Copy link
Copy Markdown
Member Author

@Pierre-Sassoulas I just added the test files in Prospector check :-)

Copy link
Copy Markdown
Collaborator

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing !

@Pierre-Sassoulas Pierre-Sassoulas merged commit 11c9704 into master Apr 11, 2025
7 checks passed
@Pierre-Sassoulas Pierre-Sassoulas deleted the rm-exit-zero branch April 11, 2025 08:11
@carlio
Copy link
Copy Markdown
Member

carlio commented Apr 11, 2025

It's worth pointing out that the .prospector.yml profile in this repo and default inherited profiles will still ignore tests - see the output of prospector --show-profile which still includes:

ignore-paths:
- docs/
ignore-patterns:
- ^docs?/
- ^tests?/?
- /tests?(/|$)
- .*/tests(/|$)
- (^|/)test_[_a-zA-Z0-9]+.py$
- (^|/)[_a-zA-Z0-9]+_tests?.py$
- (^|/)tests?.py
- ^setup.py$
- (^|/)\..+

However if you add test-warnings: yes to .prospector.yml then it will lint them and then there are a bunch of warnings

The logic of this originally was: if you lint everything it might overwhelm people and discourage them, so make it so only "medium or worse" things were highlighted and tests were not as important as the main code. The idea being it'd encourage fixing those, then turning on more linting later. I think that's still valid, since prospector was meant to be the 'gateway' tool before really starting to configure pylint and flake8 and so on though the landscape has changed a lot since I made that design choice!

@sbrunner
Copy link
Copy Markdown
Member Author

Then we should (one of them):

What do you think?

@carlio
Copy link
Copy Markdown
Member

carlio commented Apr 11, 2025

Why not simple update the prospector profile to have test-warnings; yes? That works with current master (when running pre-commit run --all) to lint the tests, and will be consistent for manually running prospector too.

@sbrunner
Copy link
Copy Markdown
Member Author

For is it's working effectively, but for the other I think that set pass_filenames to false can be a not bad possibility? I also notice that some tool like mypy change the results when the list changes, this is a little fit annoying!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants