v0.1.6: Overriding sub-setting category nulls other inherited settings (#4348)
- Dominant language
- Rust
- Stars
- 49.7k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
Very similar to the issue described in https://github.com/astral-sh/ruff/issues/4348. I have a root dir with a file that looks a bit like:
proj/.ruff.toml:
>[lint.isort]
section-order = ["standard-library", "common_pkgs", "third-party", "same_subcomp"]
[lint.isort.sections]
"common_pkgs" = ["numpy", "behave", ]
"same_subcomp"= []
proj/subdir/.ruff.toml:
>extend = "../.ruff.toml"
[lint.isort.sections]
"same_subcomp" = ["\"]
Using a command such as ruff proj/subdir/ returns me an error like:
>warning: `section-order` contains unknown section: `UserDefined("common_pkgs")`
Which means that isort.sections is being completely overwritten, when I expected to only overwrite the value of "same_subcomp". I can also confirm that the sorting of imports is not behaving as expected, as it will put numpy in the middle of the third party, when I want it to have its own block.
If this is the intended behavior, which I assumed it wasn't given issue #4348, is there a simple way I can achieve *my* intended behavior without copying the definition of common_pkgs to the .ruff.toml in every subdir?
Thanks in advance.
Contributor guide
Research direction
Reproduce the warning with the root proj/.ruff.toml, subdir/.ruff.toml, and the ruff proj/subdir/ command. Start by tracing configuration inheritance for [lint.isort.sections]; done means overriding same_subcomp preserves inherited common_pkgs and section-order without the unknown-section warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100