Skip to content

Feature: Disable unused args check for stub functions #12963

@dargueta

Description

@dargueta

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions