Skip to content

Overriding one sub-setting nulls out other inherited settings #4348

@hotpxl

Description

@hotpxl

Problem description

I'm using extend to extend the base configuration from a parent directory, then override isort.required-imports. But as soon as I override isort.required-imports, other settings under isort section from the parent configuration are lost. I was expecting to only override the sub-setting I specified and inherit the rest.

For reproducing the issue, I have the following tree:

root/
  .ruff.toml
  subdir/
    .ruff.toml
    a.py

root/.ruff.toml has

select = ["I"]

[isort]
required-imports = ["from __future__ import annotations"]
forced-separate = ["my_utils"]

root/subdir/.ruff.toml has

extend = "../.ruff.toml"

[isort]
required-imports = []

root/subdir/a.py has

import my_utils
import other_utils

my_utils.a()
other_utils.b()

When I run ruff check --fix **/**, ruff does not split my_utils and other_utils imports, unless I also add forced-separate = ["my_utils"] to root/subdir/.ruff.toml.

(I can also verify this behavior using --show-settings)

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions