-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ruff format conflict warnings are shown twice #8271
Comments
I have the same problem. But for another rule. > ruff format --check .
warning: The following rules may cause conflicts when used with the formatter: 'D206'. To avoid unexpected behavior, we recommend disabling these rules, either by removing them from the `select` or `extend-select` configuration, or adding then to the `ignore` configuration.
warning: The following rules may cause conflicts when used with the formatter: 'D206'. To avoid unexpected behavior, we recommend disabling these rules, either by removing them from the `select` or `extend-select` configuration, or adding then to the `ignore` configuration. (I know I should disable This is my Ruff config: [tool.ruff]
cache-dir = "/tmp/.cache/ruff"
line-length = 120
# All uncommented lines should be fixed and enabled
select = [
# These are a copy of the Ruff defaults
# "F" is Pyflakes, "E" is pycodestyle
"E4", "E7", "E9", "F",
"A", # flake8-builtins
# "B", # flake8-bugbear
# "C4", # flake8-comprehensions
"C90", # mccabe
# "COM", # flake8-commas
"D", # pydocstyle
# "FIX", # flake8-fixme
# "RUF100", # Ruff rule: Enforce that noqa directives are "valid"
# "S", # flake8-bandit
"TID", # flake8-tidy-imports
# "Q", # flake8-quotes
]
# All these ignores should be fixed (except for Q000 which should stay)
ignore = [
"COM812", # flake8-commas "Trailing comma missing"
"D10", # pydocstyle "Missing docstring in ..."
"D203", # pydocstyle "one-blank-line-before-class" conflicting with D211
"D205", # pydocstyle "1 blank line required between summary line and description"
"D208", # pydocstyle "Docstring is over-indented"
"D209", # pydocstyle "Multi-line docstring closing quotes should be on a separate line"
"D211", # pydocstyle "no-blank-line-before-class" conflicting with D203
"D212", # pydocstyle "multi-line-summary-second-line" conflicting with D213
"D213", # pydocstyle "no-blank-line-before-class" conflicting with D212
"D400", # pydocstyle "First line should end with a period"
"D401", # pydocstyle "First line of docstring should be in imperative mood"
"D404", # pydocstyle "First word of the docstring should not be "This""
"D403", # pydocstyle "First word of the first line should be capitalized"
"D407", # pydocstyle "Missing dashed underline after section ("Return")"
"D415", # pydocstyle "First line should end with a period, question mark, or exclamation point"
"D419", # pydocstyle "Docstring is empty"
"E713", # pycodestyle "Test for membership should be `not in`"
"Q000", # flake8-quotes "Single quotes found but double quotes preferred"
]
[tool.ruff.format]
quote-style = "single"
[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all" |
Thanks. I think that happens if you have multiple configurations in your project. We should only show it once. |
@MichaReiser Do you mean multiple |
@thernstig I would expect this to happen if you have multiple |
Got it, I can confirm I only have one. |
I have one too. Here is a minimal repo reproducing the bug: https://github.com/yakMM/test-double-warning |
## Summary Uses `warn_user_once!` instead of `warn!` to ensure that every warning is shown exactly once, regardless of whether there are duplicates in the list, or warnings that are raised by multiple configuration files. Closes #8271.
👍 Yeah that's a separate code path and issue. |
Edit : i was using an old version of ruff in the pre-commit-config.yaml (0.1.2), i upgraded it to v0.4.2 and the warnings disapeared . I have the same warning with
my pre-commit-config.yaml :
my ruff.toml :
|
@AmineDjeghri are you just seeing this once for the linter and once for the formatter? Those pre-commit runs are fully separate from our perspective. |
it's fixed in the latest version |
Happening since ruff format stable was introduced afaik.
Tested on ruff
0.1.3
:Reproduction steps:
Create a python project with ruff, minimal config:
Run
ruff format src
The warning is showing twice in the console:
The text was updated successfully, but these errors were encountered: