Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hotpxl opened this issue May 10, 2023 · 1 comment · Fixed by #4431
Closed

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

hotpxl opened this issue May 10, 2023 · 1 comment · Fixed by #4431
Labels
configuration Related to settings and configuration

Comments

@hotpxl
Copy link

hotpxl commented May 10, 2023

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)

@charliermarsh charliermarsh added the configuration Related to settings and configuration label May 10, 2023
@charliermarsh
Copy link
Member

I agree -- we should be overriding on a per-key basis, not a per-section basis.

bendoerry added a commit to bendoerry/ruff that referenced this issue May 14, 2023
To be honest this isn't quite "all" plugins,
just those we already combine in `Configuration`.

Fixes astral-sh#4348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants