-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fixit cli doesn't return non-zero exit code upon exceptions - add --exit-non-zero / --exit-zero options #258
Comments
amyreese
added a commit
that referenced
this issue
Mar 15, 2023
This tracks exit codes based on the existence of violations and/or errors when linting files. - 0: everything clean - 1: violations only - 2: errors only - 3: both violations and errors Fixes #258 [ghstack-poisoned]
amyreese
added a commit
that referenced
this issue
Mar 15, 2023
…errors" This tracks exit codes based on the existence of violations and/or errors when linting files. - 0: everything clean - 1: violations only - 2: errors only - 3: both violations and errors Fixes #258 [ghstack-poisoned]
amyreese
added a commit
that referenced
this issue
Mar 15, 2023
This tracks exit codes based on the existence of violations and/or errors when linting files. - 0: everything clean - 1: violations only - 2: errors only - 3: both violations and errors Fixes #258 [ghstack-poisoned]
Thank you @amyreese ! |
This issue appears to have regressed: $ cat t.py
this is not valid python
$ fixit fix -a t.py
t.py: EXCEPTION: Syntax Error @ 1:1.
parser error: error at 1:24: expected one of !=, %, &, (, *, **, +, ,, -, ., /, //, ;, <, <<, <=, ==, >, >=, >>, @, NEWLINE, [, ^, and, if, in, is, not, or, |
this is not valid python
^
Traceback (most recent call last):
File "/private/tmp/tmpvenv-c329d/venv/lib/python3.11/site-packages/fixit/api.py", line 100, in fixit_bytes
runner = LintRunner(path, content)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/tmpvenv-c329d/venv/lib/python3.11/site-packages/fixit/engine.py", line 55, in __init__
self.module: Module = parse_module(source)
^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/tmpvenv-c329d/venv/lib/python3.11/site-packages/libcst/_parser/entrypoints.py", line 109, in parse_module
result = _parse(
^^^^^^^
File "/private/tmp/tmpvenv-c329d/venv/lib/python3.11/site-packages/libcst/_parser/entrypoints.py", line 55, in _parse
return parse(source_str)
^^^^^^^^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 1:1.
parser error: error at 1:24: expected one of !=, %, &, (, *, **, +, ,, -, ., /, //, ;, <, <<, <=, ==, >, >=, >>, @, NEWLINE, [, ^, and, if, in, is, not, or, |
this is not valid python
^
🛠️ 1 file checked, 1 file with errors 🛠️
$ echo $?
0 Fixit version 2.1.0, Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Commands like
can fail for some files in the CI silently and there is no way to detect it via the exit code - parsing also cannot be done reliably:
Linters like
flake8
exit with non-zero code per default and they have an option like--exit-zero
to ignore errors. Formatterblack
has option--check
.I would suggest to make
fixit
fail is some exception happens per default and add--exit-zero
to opt out. Otherwise one can make this an opt-in functionality like--exit-non-zero
.I think this is quite important, especially after LibCST parser update, because problems can easily go unnoticed, if the is no way to make
fixit
return a non-zero code upon errors.Thanks!
The text was updated successfully, but these errors were encountered: