You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure exactly what output should be in the --no-fix-only --diff case, but a non-zero exit would be nice, perhaps errors can be printed to stderr?
The text was updated successfully, but these errors were encountered:
pnovotnak
changed the title
Possible bug: Diff flag suppresses errors, with no clear way to enable errors
Possible bug: Diff flag suppresses non-fixable errors, with no clear way to enable
Nov 14, 2023
Perhaps it's possible for us to allow opt-in to this behavior with --no-fix-only but I don't think that's a very clear user experience and may prefer #7352
I ran into exactly the same problem, and just like the reporter, I tried adding --diff --exit-non-zero-on-fix --no-fix-only to get my exit error code to be non-zero.
@zanieb Isn't it fairly standard behavior that options to the right have precedence over options to the left on the command line, so one can append more arguments ($cmd --no-x --x --no-x --x --no-x) to get the desired ($cmd --no-x) behavior?
If anyone wants more context, here is an excerpt from the Makefile I'm trying to incorporate Ruff into:
Q ?= @
lint.black:
$(Q)poetry run black --check --diff $(PYTHON_SRC_DIRS)
lint.isort:
$(Q)poetry run isort --check-only --filter-files --diff $(PYTHON_SRC_DIRS)
ifdefCI_BUILDS_DIRlint.mypy: MYPY_CI_PARAMS ?= --junit-xml mypy-report.xml --junit-format=per_file
endiflint.mypy:
$(Q)poetry run mypy --warn-unused-ignores $(MYPY_CI_PARAMS) $(PYTHON_SRC_DIRS)
<more lint rules that execute various tools>
Hello! I discovered what I think is a possible bug with the tool that I wanted to bring to your attention.
I'm using this config:
My test case is this file (call it
x.py
):In CI, it's useful to have the
--diff
flag enabled. However, with the following script:No errors are reported when fixes are not available. I think that makes sense, but it's still not reporting errors when
--no-fix-only
is passed.I'm not sure exactly what output should be in the
--no-fix-only --diff
case, but a non-zero exit would be nice, perhaps errors can be printed to stderr?The text was updated successfully, but these errors were encountered: