Skip to content

Documentation for extend doesn't accurately describe lint.ignore and lint.select behavior #21073

@chirizxc

Description

@chirizxc

The current documentation for the extend configuration option states:

"To resolve the current pyproject.toml file, Ruff will first resolve this base configuration file, then merge in any properties defined in the current configuration file."

This description is misleading for lint.ignore and lint.select options, as their behavior depends on whether select is specified in the child configuration.

Actual Behavior:

  1. Without select in child config (code)

When select is not specified in the child config, rule_selections from parent and child configs are accumulated into a vector, not replaced.

# Parent config  
[lint]
select = ["ALL"]
ignore = ["E501"]

# Child config
extend = "../ruff.toml"
[lint]
ignore = ["F401"]

# Result: Both E501 AND F401 are ignored (accumulated)
  1. With select in child config (code)

When select is specified in the child config, it triggers a complete reset of select_set, and parent's ignore rules are not applied.

# Parent config
[lint]
select = ["ALL"]
ignore = ["E501"]

# Child config
extend = "../ruff.toml"
[lint]
select = ["EM", "TC"]
ignore = ["EM102", "TC001"]

# Result: Only EM102 and TC001 is ignored (parent's E501 is NOT ignored)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions