Skip to content

[pylint] Implement no-method-argument (PLE0211) - #29748

Merged
ntBre merged 4 commits into
astral-sh:mainfrom
s-cork:stu-dev/ruff/no-method-argument
Nov 6, 2026
Merged

ntBre merged 4 commits into
astral-sh:mainfrom
s-cork:stu-dev/ruff/no-method-argument

Conversation

@s-cork

@s-cork s-cork commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

We use Ruff for linting in our browser based IDE and supplement it with a few checks that are helpful for our users, particularly novice programmers. Forgetting to include self in a method is common enough that we already have our own check for it.

N805 partially covers this: it catches methods whose first parameter isn't named self, but it doesn't report methods with no parameters at all. This is an easy mistake when a method needs no arguments beyond the instance: the user writes def refresh(): instead of def refresh(self):.

This PR adds Pylint's no-method-argument / E0211 as PLE0211, in preview. It's tracked in #970. Following the discussion in #11605, this is a separate rule; N804 and N805 keep their existing scope.

I've classified it as Suspicious because a zero-argument function defined in a class can still be called directly through the class. Calling it through an instance fails, so the definition is often a mistake, but it can be intentional. The documentation explains this limitation and the **kwargs exemption retained from Pylint E0211.

There is no automatic fix: adding a receiver and making the function static express different intentions.

Test Plan

  • All nine Pylint mdtest files pass, including the new rule's examples and diagnostic snapshot. These cover instance/class methods, static methods, keyword-only and variadic signatures, special methods, custom decorators, suppressions and independent N804/N805 selection.
  • Generated documentation and schema checked with cargo dev generate-all --mode check.
  • Applicable prek checks pass for all six changed files.
  • CLI smoke test reports empty instance/class methods and accepts an empty static method.

@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview-mode features labels Oct 27, 2026

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks reasonable to me, and it looks like it will also close a recent ty issue: astral-sh/ty#4756. I just had a few minor suggestions.

@s-cork

s-cork commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, that does simplify the implementation. I’ve pushed those suggestions.

The one case I might push back on is a method with only a built-in @classmethod decorator and no parameters. This will fail when called.

I’ve also looked a bit more closely at Pylint’s implementation. Pylint reports E0211 for all three of these cases, which this implementation now skips:

def identity(function):
    return function

class Example:
    @classmethod
    def class_method(): ...

    @identity
    def decorated(): ...

    def keyword_only(*, value=1): ...

Pylint seems to check decorated methods unless it recognises them as returning static methods.

It also reports methods with only keyword-only parameters. Using parameters.is_empty() skips that case. N805 doesn’t cover it either, as it only checks positional parameters.

I think the PR as it stands covers the common case of forgetting self in an otherwise parameterless method. Let me know if you’d like me to add support for any of the above.

@s-cork
s-cork force-pushed the stu-dev/ruff/no-method-argument branch from 8120c24 to 534106c Compare October 28, 2026 01:14
@s-cork
s-cork requested a review from ntBre November 4, 2026 07:37

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

You raised some good points in your comment. I think I'm happy with the current, slightly more conservative version of the rule as a starting point, though. We can always consider expanding it a bit further while it's in preview.

@ntBre
ntBre enabled auto-merge (squash) November 6, 2026 21:42
@ntBre
ntBre merged commit 4cec5d2 into astral-sh:main Nov 6, 2026
57 checks passed
@BLKSerene BLKSerene mentioned this pull request Nov 13, 2026
rlichtenwalter added a commit to rlichtenwalter/dir2text that referenced this pull request Nov 13, 2026
This PR contains the following updates:

| Package | Type | Update | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [DavidAnson/markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) | repository | patch | `v0.24.0` → `v0.24.1` | ![age](https://developer.mend.io/api/mc/badges/age/github-tags/DavidAnson%2fmarkdownlint-cli2/v0.24.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/DavidAnson%2fmarkdownlint-cli2/v0.24.0/v0.24.1?slim=true) |
| [rbubley/mirrors-prettier](https://github.com/rbubley/mirrors-prettier) | repository | minor | `v3.9.10` → `v3.10.1` | ![age](https://developer.mend.io/api/mc/badges/age/github-tags/rbubley%2fmirrors-prettier/v3.10.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/rbubley%2fmirrors-prettier/v3.9.10/v3.10.1?slim=true) |
| [ruff](https://docs.astral.sh/ruff) ([source](https://github.com/astral-sh/ruff), [changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | dependency-groups | patch | `==0.17.3` → `==0.17.5` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.17.5?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.17.3/0.17.5?slim=true) |

Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://github.com/renovatebot/renovate/discussions/new) if you have any questions.

---

### Release Notes

<details>
<summary>DavidAnson/markdownlint-cli2</summary>

### [`v0.24.1`](DavidAnson/markdownlint-cli2@v0.24.0...v0.24.1)

[Compare Source](DavidAnson/markdownlint-cli2@v0.24.0...v0.24.1)

</details>

<details>
<summary>rbubley/mirrors-prettier</summary>

### [`v3.10.1`](rbubley/mirrors-prettier@v3.10.0...v3.10.1)

[Compare Source](rbubley/mirrors-prettier@v3.10.0...v3.10.1)

### [`v3.10.0`](rbubley/mirrors-prettier@v3.9.10...v3.10.0)

[Compare Source](rbubley/mirrors-prettier@v3.9.10...v3.10.0)

</details>

<details>
<summary>astral-sh/ruff (ruff)</summary>

### [`v0.17.5`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0175)

[Compare Source](astral-sh/ruff@0.17.4...0.17.5)

Released on 2026-11-12.

##### Preview features

- Redirect renamed rules ([#&#8203;30081](astral-sh/ruff#30081))
- \[`flake8-async`] Implement `pytest-raises-exception-group` (`ASYNC401`) ([#&#8203;28772](astral-sh/ruff#28772))
- \[`flake8-logging-format`] Mark `G004` fix as unsafe ([#&#8203;30087](astral-sh/ruff#30087))
- \[`pylint`] Implement `no-method-argument` (`PLE0211`) ([#&#8203;29748](astral-sh/ruff#29748))
- \[`refurb`] Do not offer fix when `write` is nested in an expression (`FURB103`) ([#&#8203;29789](astral-sh/ruff#29789))
- \[`ruff`] Add `renamed-rule` (`RUF202`) ([#&#8203;30079](astral-sh/ruff#30079))
- \[`ruff`] Expand `redirected-noqa` to other suppression comments (`RUF101`) ([#&#8203;30078](astral-sh/ruff#30078))

##### Bug fixes

- Avoid crashing when Ruff logs to a closed stderr pipe ([#&#8203;30209](astral-sh/ruff#30209))
- Fix fixes that add or remove a keyword argument with a parenthesized value ([#&#8203;30189](astral-sh/ruff#30189))
- \[`flake8-import-conventions`] Avoid shadowing names when fixing import aliases (`ICN001`) ([#&#8203;30035](astral-sh/ruff#30035))
- \[`flake8-bugbear`] Fix `B010` autofix for parenthesized `setattr` calls ([#&#8203;30168](astral-sh/ruff#30168))
- \[`flake8-pyi`] Fix `PYI034` autofix for parenthesized `self` annotations ([#&#8203;30173](astral-sh/ruff#30173))
- \[`pyupgrade`] Fix `UP031` duplicating closing parentheses around the format string ([#&#8203;30172](astral-sh/ruff#30172))

##### Rule changes

- \[`flake8-bugbear`] Ignore frozen dataclass instantiations (`B008`) ([#&#8203;29231](astral-sh/ruff#29231))

##### Performance

- Various performance improvements ([#&#8203;30375](astral-sh/ruff#30375), [#&#8203;30211](astral-sh/ruff#30211), [#&#8203;30368](astral-sh/ruff#30368), [#&#8203;30259](astral-sh/ruff#30259), [#&#8203;30354](astral-sh/ruff#30354), [#&#8203;30115](astral-sh/ruff#30115), [#&#8203;30133](astral-sh/ruff#30133), [#&#8203;30132](astral-sh/ruff#30132), [#&#8203;30358](astral-sh/ruff#30358), [#&#8203;30135](astral-sh/ruff#30135), [#&#8203;30369](astral-sh/ruff#30369), [#&#8203;30351](astral-sh/ruff#30351), [#&#8203;30352](astral-sh/ruff#30352), [#&#8203;30347](astral-sh/ruff#30347), [#&#8203;30379](astral-sh/ruff#30379), [#&#8203;30328](astral-sh/ruff#30328), [#&#8203;30329](astral-sh/ruff#30329), [#&#8203;29446](astral-sh/ruff#29446))

##### Other changes

- Fix FreeBSD source builds with libc 0.2.190 ([#&#8203;30176](astral-sh/ruff#30176))

##### Contributors

- [@&#8203;rajveer3x](https://github.com/rajveer3x)
- [@&#8203;tjkuson](https://github.com/tjkuson)
- [@&#8203;hugehoo](https://github.com/hugehoo)
- [@&#8203;hector2394](https://github.com/hector2394)
- [@&#8203;ansh-rohilla](https://github.com/ansh-rohilla)
- [@&#8203;mati-caliz](https://github.com/mati-caliz)
- [@&#8203;yxshee](https://github.com/yxshee)
- [@&#8203;charliermarsh](https://github.com/charliermarsh)
- [@&#8203;MichaReiser](https://github.com/MichaReiser)
- [@&#8203;GeorgiaPreda](https://github.com/GeorgiaPreda)
- [@&#8203;G26karthik](https://github.com/G26karthik)
- [@&#8203;ntBre](https://github.com/ntBre)
- [@&#8203;s-cork](https://github.com/s-cork)

### [`v0.17.4`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0174)

[Compare Source](astral-sh/ruff@0.17.3...0.17.4)

Released on 2026-11-05.

##### Preview features

- \[`flake8-logging-format`] Avoid behavior changes and syntax errors in fixes (`G004`) ([#&#8203;27419](astral-sh/ruff#27419))
- \[`security`] Implement `tarfile-ignore-zeros-true` ([#&#8203;28680](astral-sh/ruff#28680))

##### Bug fixes

- Accept a bare raise before a semicolon ([#&#8203;29761](astral-sh/ruff#29761))
- Allow match identifiers after a semicolon ([#&#8203;29760](astral-sh/ruff#29760))
- Fix panic on BOM-prefixed files in diagnostic renderer ([#&#8203;30017](astral-sh/ruff#30017))
- \[`flake8-simplify`] Report collapsible `elif` clauses after a multi-statement `if` branch (`SIM102`) ([#&#8203;29814](astral-sh/ruff#29814))

##### Rule changes

- Show more nonprinting characters in diagnostic fix diffs ([#&#8203;30062](astral-sh/ruff#30062))

##### Performance

- Coalesce source slices when formatting attributes ([#&#8203;29841](astral-sh/ruff#29841))
- Collect return statements with a statement-only visitor ([#&#8203;29911](astral-sh/ruff#29911))

(PR body shortened for the merge commit; full text on the PR.)

Reviewed-on: https://git.lichtenwalter.site/rlichten/dir2text/pulls/109
Stensel8 pushed a commit to Stensel8/streamrip that referenced this pull request Nov 14, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) ([changelog](https://pytest-asyncio.readthedocs.io/en/stable/reference/changelog.html)) | `==1.4.1.post1` → `==1.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/pytest-asyncio/1.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pytest-asyncio/1.4.1.post1/1.5.0?slim=true) |
| [ruff](https://docs.astral.sh/ruff) ([source](https://github.com/astral-sh/ruff), [changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | `==0.17.4` → `==0.17.5` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.17.5?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.17.4/0.17.5?slim=true) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest-asyncio (pytest-asyncio)</summary>

### [`v1.5.0`](https://github.com/pytest-dev/pytest-asyncio/releases/tag/v1.5.0): pytest-asyncio v1.5.0

[Compare Source](pytest-dev/pytest-asyncio@v1.4.1.post1...v1.5.0)

### [1.5.0](https://github.com/pytest-dev/pytest-asyncio/tree/1.5.0) - 2026-11-12

#### Added

- A `fixture-scope` value for `asyncio_default_fixture_loop_scope`. With it, an asynchronous fixture without `loop_scope` uses its `scope` as its loop scope. This is the behavior of an unset option in pytest-asyncio 1.x. ([#&#8203;1095](pytest-dev/pytest-asyncio#1095))

#### Fixed

- Invalid arguments to the `asyncio` marker, including an invalid `loop_scope`, are reported with a message that names the test instead of a traceback. ([#&#8203;1584](pytest-dev/pytest-asyncio#1584))

</details>

<details>
<summary>astral-sh/ruff (ruff)</summary>

### [`v0.17.5`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0175)

[Compare Source](astral-sh/ruff@0.17.4...0.17.5)

Released on 2026-11-12.

##### Preview features

- Redirect renamed rules ([#&#8203;30081](astral-sh/ruff#30081))
- \[`flake8-async`] Implement `pytest-raises-exception-group` (`ASYNC401`) ([#&#8203;28772](astral-sh/ruff#28772))
- \[`flake8-logging-format`] Mark `G004` fix as unsafe ([#&#8203;30087](astral-sh/ruff#30087))
- \[`pylint`] Implement `no-method-argument` (`PLE0211`) ([#&#8203;29748](astral-sh/ruff#29748))
- \[`refurb`] Do not offer fix when `write` is nested in an expression (`FURB103`) ([#&#8203;29789](astral-sh/ruff#29789))
- \[`ruff`] Add `renamed-rule` (`RUF202`) ([#&#8203;30079](astral-sh/ruff#30079))
- \[`ruff`] Expand `redirected-noqa` to other suppression comments (`RUF101`) ([#&#8203;30078](astral-sh/ruff#30078))

##### Bug fixes

- Avoid crashing when Ruff logs to a closed stderr pipe ([#&#8203;30209](astral-sh/ruff#30209))
- Fix fixes that add or remove a keyword argument with a parenthesized value ([#&#8203;30189](astral-sh/ruff#30189))
- \[`flake8-import-conventions`] Avoid shadowing names when fixing import aliases (`ICN001`) ([#&#8203;30035](astral-sh/ruff#30035))
- \[`flake8-bugbear`] Fix `B010` autofix for parenthesized `setattr` calls ([#&#8203;30168](astral-sh/ruff#30168))
- \[`flake8-pyi`] Fix `PYI034` autofix for parenthesized `self` annotations ([#&#8203;30173](astral-sh/ruff#30173))
- \[`pyupgrade`] Fix `UP031` duplicating closing parentheses around the format string ([#&#8203;30172](astral-sh/ruff#30172))

##### Rule changes

- \[`flake8-bugbear`] Ignore frozen dataclass instantiations (`B008`) ([#&#8203;29231](astral-sh/ruff#29231))

##### Performance

- Various performance improvements ([#&#8203;30375](astral-sh/ruff#30375), [#&#8203;30211](astral-sh/ruff#30211), [#&#8203;30368](astral-sh/ruff#30368), [#&#8203;30259](astral-sh/ruff#30259), [#&#8203;30354](astral-sh/ruff#30354), [#&#8203;30115](astral-sh/ruff#30115), [#&#8203;30133](astral-sh/ruff#30133), [#&#8203;30132](astral-sh/ruff#30132), [#&#8203;30358](astral-sh/ruff#30358), [#&#8203;30135](astral-sh/ruff#30135), [#&#8203;30369](astral-sh/ruff#30369), [#&#8203;30351](astral-sh/ruff#30351), [#&#8203;30352](astral-sh/ruff#30352), [#&#8203;30347](astral-sh/ruff#30347), [#&#8203;30379](astral-sh/ruff#30379), [#&#8203;30328](astral-sh/ruff#30328), [#&#8203;30329](astral-sh/ruff#30329), [#&#8203;29446](astral-sh/ruff#29446))

##### Other changes

- Fix FreeBSD source builds with libc 0.2.190 ([#&#8203;30176](astral-sh/ruff#30176))

##### Contributors

- [@&#8203;rajveer3x](https://github.com/rajveer3x)
- [@&#8203;tjkuson](https://github.com/tjkuson)
- [@&#8203;hugehoo](https://github.com/hugehoo)
- [@&#8203;hector2394](https://github.com/hector2394)
- [@&#8203;ansh-rohilla](https://github.com/ansh-rohilla)
- [@&#8203;mati-caliz](https://github.com/mati-caliz)
- [@&#8203;yxshee](https://github.com/yxshee)
- [@&#8203;charliermarsh](https://github.com/charliermarsh)
- [@&#8203;MichaReiser](https://github.com/MichaReiser)
- [@&#8203;GeorgiaPreda](https://github.com/GeorgiaPreda)
- [@&#8203;G26karthik](https://github.com/G26karthik)
- [@&#8203;ntBre](https://github.com/ntBre)
- [@&#8203;s-cork](https://github.com/s-cork)

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Amsterdam)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zOS4yIiwidXBkYXRlZEluVmVyIjoiNDQuMzkuMiIsInRhcmdldEJyYW5jaCI6ImRldiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJweXRob24iXX0=-->

Reviewed-on: https://opencommit.eu/Stensel8/streamrip/pulls/114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview-mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants