Skip to content

Confusing note on exclude option in tool.ruff.format #8301

@Giuzzilla

Description

@Giuzzilla

I was checking the various options for tool.ruff.format and in particular I wanted to add additional exclusions to the formatter (in addition to the exclusions in tool.ruff.

The documentation of this option can be found at: https://docs.astral.sh/ruff/settings/#format-exclude

The documentation correctly says

A list of file patterns to exclude from formatting in addition to the files excluded globally.

I had two doubts about this:

  1. The use of the keyword exclude instead of extend-exclude might make you think that this list is not "additive" / on top of the global one. (changing this would be a kind of breaking change though and the current behaviour is documented)
  2. The doc within the tool.ruff.format section of exclude says:

Note that you'll typically want to use extend-exclude to modify the excluded paths.

However, no such option is available for the formatter so one might confuse the tool.ruff.format.exclude behavior with the behaviour of the global tool.ruff.exclude (which is not additive). This text seems to be a copy-paste from the global exclude option documentation

Metadata

Metadata

Assignees

No one assigned

    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