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

Unknown fields for [tool.ruff.lint.isort] #354

Closed
einarwar opened this issue Dec 11, 2023 · 3 comments
Closed

Unknown fields for [tool.ruff.lint.isort] #354

einarwar opened this issue Dec 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@einarwar
Copy link

I was very pleased when astral-sh/ruff#8841 was released. However, when i tried to modify my setup and replace isort with ruff-isort, i was not able to get auto-formatting using the VSCode extension.

Running Ruff VSCode extension v2023.50.0 with import strategy set to fromEnvironment.
Running Ruff 0.1.7

Minimal pyproject.toml

[tool.ruff]
select = ["I"]
[tool.ruff.lint.isort]
length-sort = true

When checking ruff output in vscode, i get the following

2023-12-11 15:19:52.124 [info] ruff failed
  Cause: TOML parse error at line 15, column 1
   |
1  | [tool.ruff]
   | ^^^^^^^^^^^
unknown field `length-sort`, expected one of `force-wrap-aliases`, `force-single-line`, `single-line-exclusions`, `combine-as-imports`, `split-on-trailing-comma`, `order-by-type`, `force-sort-within-sections`, `case-sensitive`, `force-to-top`, `known-first-party`, `known-third-party`, `known-local-folder`, `extra-standard-library`, `relative-imports-order`, `required-imports`, `classes`, `constants`, `variables`, `no-lines-before`, `lines-after-imports`, `lines-between-types`, `forced-separate`, `section-order`, `no-sections`, `detect-same-package`, `sections`

I might be totally wrong here, but it seems like the extension is using an old json-schema at https://json.schemastore.org/ruff.json this might be the issue, and an update to the schema is the only thing needed.

If this is the case, would it be an idea if fromEnvironment is set to True, that the json-schema from the ruff package is used instead of the one from the json schemastore? I might be oversimplifying this, and i also understand that the extension must be available to use without the package.

@charliermarsh
Copy link
Member

Ah yeah, we need to update the JSON Schema in schemastore. Unfortunately, that's just a process that's entirely separate from the release, and so the version in schemastore is occasionally out-of-sync with main.

@charliermarsh
Copy link
Member

I've updated the schema in SchemaStore/schemastore#3436. This should be resolved once that's merged.

@charliermarsh charliermarsh added the bug Something isn't working label Dec 11, 2023
@einarwar
Copy link
Author

Wow, that was fast. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants