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

Setting for a rule enables it implicitly #3683

Closed
kytta opened this issue Mar 23, 2023 · 5 comments
Closed

Setting for a rule enables it implicitly #3683

kytta opened this issue Mar 23, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@kytta
Copy link

kytta commented Mar 23, 2023

I have a big Python project that I am migrating to use Ruff. For now, I disable some of the rules in order to enable them later (I do not want to break my CI just yet). However, I already defined some settings for the rules I will use in the future.

Here's a very minimal example:

# pyproject.toml

[tool.ruff]
extend-select = [
    # TODO: fix docs in a separate issue
    # "D",  # pydocstyle
    "PT",  # flake8-pytest-style
]

fixable = [
    "PT001",  # pytest fixture with parens
    "PT006",  # tuple in pytest parametrize
]

[tool.ruff.pydocstyle]
convention = "pep257"
# main.py

def my_func(arg):
   '''Return something
   param docs are not provided'''


   return arg+1

What I expect

I expect that when I run Ruff, it will only care about the enabled rules (the default E and F as well as the PT). D is not selected, so Ruff is not bothering to fix it.

Actual behaviour

Ruff detects (and attempts to fix) the D issues:

$ ruff . --format=grouped --show-fixes   
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
myproject/main.py:
  2:4  D415 [*] First line should end with a period, question mark, or exclamation point

Found 1 error.
[*] 1 potentially fixable with the --fix option.

Workaround?

I don't know if it's expected behaviour or not. In any case, if I also comment the [tool.ruff.pydocstyle] out, the ruleset gets ignored properly


Ruff version is 0.0.258

@JonathanPlasse
Copy link
Contributor

convention is used to select which pydocstyle use and enable the corresponding D rules.
https://beta.ruff.rs/docs/settings/#convention
Why did you add it to your configuration?

@kytta
Copy link
Author

kytta commented Mar 23, 2023

Why did you add it to your configuration?

I generally want to enforce it, but not at this point in time, since the repo is too "dirty". That's why I temporarily disabled the rule inside select.

[...] and enable the corresponding D rules.

I see, I guess it's desired behaviour, then. Thanks!

@kytta kytta closed this as completed Mar 23, 2023
@charliermarsh
Copy link
Member

I thought enabling D was required, this seems like a bug, lemme look into it.

@charliermarsh charliermarsh reopened this Mar 23, 2023
@charliermarsh charliermarsh self-assigned this Mar 23, 2023
@charliermarsh
Copy link
Member

Sorry about that, this is a confirmed regression in the latest release. You can downgrade to 0.0.257 for now, but we'll ship a fix soon.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 23, 2023
@charliermarsh
Copy link
Member

Should be fixed by #3685, which'll go out later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants