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

With pre-commit, exits with 1 as return value even with no messages for linters #390

Open
akaihola opened this issue Sep 2, 2022 · 3 comments
Labels
bug Something isn't working question Further information is requested

Comments

@akaihola
Copy link
Owner

akaihola commented Sep 2, 2022

When running via pre-commit, even if there is nothing to report from linters, darker seems to provide a 1 as exit code so pre-commit fails.

[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to [...]
darker...................................................................Failed
- hook id: darker
- exit code: 1
[INFO] Restored changes from [...]

I guess darker just doesn't return anything if there are no problems?

Originally posted by @deadkex in #378 (comment) on 2022-08-30 (Darker 1.5.0)

@akaihola akaihola added this to the Darker 2.1.2 milestone Apr 3, 2024
@akaihola
Copy link
Owner Author

akaihola commented Apr 21, 2024

I wonder if issue akaihola/graylint#6 and its fix akaihola/graylint#34 affect this now that Darker actually uses Graylint for linting support?

@deadkex could you check whether Darker 2.1.1 with Graylint 1.1.1 fixes this issue?

@akaihola akaihola added bug Something isn't working question Further information is requested labels Apr 21, 2024
@akaihola
Copy link
Owner Author

akaihola commented Apr 21, 2024

I also now tried this on Darker 1.5.0 (from August 2022, accompanied by Black 22.8.0), and if I run darker -L pylint . ; echo $? in a repository which has no linting errors, it does print out a 0.

I didn't try pre-commit, but at least directly from the command line the behavior was correct already at the time of @deadkex's report.

@deadkex
Copy link
Collaborator

deadkex commented May 15, 2024

Hi @akaihola
something i observed back then was that while there are not linting errors - if black has some problems it will provide 1 as exit code even though i turned of black prints & formatting via config. I did not test since quite some time since we decided to switch to CI checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Development

No branches or pull requests

2 participants