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

Feature: Disable unused args check for stub functions #12963

Closed
dargueta opened this issue Aug 18, 2024 · 1 comment · Fixed by #12966
Closed

Feature: Disable unused args check for stub functions #12963

dargueta opened this issue Aug 18, 2024 · 1 comment · Fixed by #12966
Assignees

Comments

@dargueta
Copy link

Keywords: ARG, ARG001, unused argument

Feature

It'd be great if we could have some settings to disable the unused argument check for stub and abstract functions, such as one that only throws NotImplementedError and does nothing else. The Flake8 plugin has a relevant setting for this.

To Reproduce

This code:

def foo(a, b):
    raise NotImplementedError

Command: ruff check --isolated --select ARG repro.py

Output:

repro.py:1:9: ARG001 Unused function argument: `a`
  |
1 | def foo(a, b):
  |         ^ ARG001
2 |     raise NotImplementedError
  |

repro.py:1:12: ARG001 Unused function argument: `b`
  |
1 | def foo(a, b):
  |            ^ ARG001
2 |     raise NotImplementedError
  |

Found 2 errors.

Configuration

The output is the same if I don't run it in isolated mode. However, in case you may find it useful, this is the relevant part of my Ruff configuration in pyproject.toml.

[tool.ruff.lint]
extend-ignore = [
    "COM812",
    "D105",
    "EM",
    "FBT",
    "PLR2004",
    "S311",
    "TRY003",
]
select = ["ALL"]

Platform

  • Python: 3.12.3
  • Ruff: 0.6.1
@charliermarsh charliermarsh self-assigned this Aug 18, 2024
@charliermarsh
Copy link
Member

For some reason we already do this for all of the ARG rules except ARG001.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants