Skip to content

Improve --dummy-variables-rgx and --ignored-argument-names documentation #8013

Open
@nortti

Description

@nortti

Question

Could the documentation be made more helpful for people trying to ignore dummy arguments?

Documentation for future user

Suppose that I'm looking to suppress unused-argument for all function arguments starting with "mock_".

I might find the option --dummy-variables-rgx:

A regular expression matching the name of dummy variables (i.e. expected to not be used). (default: _+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_)

But wait, it doesn't work. Even though arguments are variables.

I might then find the option --ignored-argument-names:

Argument names that match this expression will be ignored. (default: re.compile('_.*|^ignored_|^unused_'))

The default value looks promising. But wait, why isn't it named --dummy-arguments-rgx? And why is the documentation so different? Is it because this is actually going to suppress a bunch of messages other than unused-variable, such as invalid_name? What does it actually do? Even regular maintainers are confused.

Eventually I learn that it will (at least) suppress unused-variable, too-many-args, and some docstring message(s).

My suggestion is to

  • clarify that --dummy-variables-rgx will not work for dummy arguments and point the user towards --ignored-argument-names, and
  • make the documentation of --ignored-argument-names clear about what it actually does (what messages it might suppress).

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentation 📗Enhancement ✨Improvement to a componentNeeds specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions