ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Disable D203, D212, D213 and S101 by default

Open not-my-profile opened this issue 2 years ago • 5 comments

(see our discussion in #2289 as well as the commit messages for the reasoning)

not-my-profile avatar Jan 28 '23 06:01 not-my-profile

Does specifying tool.ruff.pydocstyle.convention still activates the rules D203, D212, and D213?

JonathanPlasse avatar Jan 28 '23 10:01 JonathanPlasse

Good question. Previously pydocstyle.convention only disabled rules, it never enabled them, so if you didn't also select them via D it wouldn't turn them on. I do not want the new explicitly_enabled logic to somehow take the presence of a D selector into account since I think that would overcomplicate the rule selection behavior ... so I'll change pydocstyle.convention to enable these rules even if D isn't selected ... even if that is a bit of a breaking change I think it much better aligns with the probable user intention.

(Marking this as a draft till I implement that ... probably only have time for that in a couple of hours.)

not-my-profile avatar Jan 28 '23 11:01 not-my-profile

D203 and D213 aren't part of any of the valid conventions. (D212 is, and shouldn't be part of any sort of automatic disable list IMO.)

charliermarsh avatar Jan 28 '23 12:01 charliermarsh

Just an update:

  • I'd firstly like to fix the config resolution situation #2312.
  • Then I'd like to convert the pydocstyle.convention setting into a rule selector ... so you could e.g. --select pydocstyle:google and then ignore a specific rule from that rule set with --ignore
  • And then finally disable these problematic pydocstyle rules by default by implementing the changes in this PR.

not-my-profile avatar Jan 28 '23 20:01 not-my-profile

Regarding the assert one, clippy deals with this by having a clippy::restriction group that is off by default, and is not meant to be enabled wholesale, but contains lints which can be enabled for specific code bases which want to enforce that some feature is not used (see lint list here). I can imagine this being useful for some Python projects, e.g. enforce no assert, no async/await, no :=, no breakpoint(), or even no exceptions.

bluetech avatar Jan 28 '23 21:01 bluetech

@not-my-profile - This came up again recently (#2368). What can we do to prioritize turning those D rules off by default?

I'd like to start by just disabling the D rules, and we can revisit the other cases later.

charliermarsh avatar Jan 30 '23 22:01 charliermarsh

Closing this for now since ba26a60e2a49716da4bd0a01b7faad17b9094216 has addressed the issue that prompted this PR.

The tracking issue for the more flexible rule categorization is #1774.

not-my-profile avatar Feb 01 '23 15:02 not-my-profile