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

Unspecific error message from tiny typo #13022

Closed
turkishmaid opened this issue Aug 21, 2024 · 2 comments · Fixed by #13029
Closed

Unspecific error message from tiny typo #13022

turkishmaid opened this issue Aug 21, 2024 · 2 comments · Fixed by #13029
Assignees
Labels
server Related to the LSP server

Comments

@turkishmaid
Copy link

Using Ruff 0.6.1 as native server in VSCode 1.92.1, Ruff extension v2024.42.0, on MacOS 14.4 (but I guess all of that is irrelevant).

With a tiny typo like this in the ruff.toml

[lint]
ignore = [
## typo, should be "EM102"
  "ME102", # f-string in exception
]
select = ["ALL", "TD006", "TD007", "FIX"]

I am shown some unspecific Ruff error popup referring to the logs:

Error while resolving settings from workspace /(redacted). Please refer to the logs for more details.
Source: Ruff

Unfortunately, in the logs there is no trace of the actual issue:

image

Took me ages to find out and I was only successful when I commented out the whole ruff.toml and added it back line by line.

Would it be possible to have a message like so instead? In the popup if that is possible, or at least in the Ruff output...

ruff.toml(/path): line 12: [lint.ignore]: "ME102" is not a valid rule

Even better would be when Ruff would lint its own settings and issue warnings about incorrect or deprecated settings in ruff.toml or pyproject.toml.

Else: Great tool. Love lightning fast linting. Sometimes I create an issue deliberately just to see it pop up 😁

@MichaReiser MichaReiser added the server Related to the LSP server label Aug 21, 2024
@dhruvmanila
Copy link
Member

Can you try turning on the server log messages via https://docs.astral.sh/ruff/editors/settings/#traceserver ?

{
    "ruff.trace.server": "messages"
}

You should then see the log messages in the output channel.

I agree that this is a bit annoying that the notification suggests to refer to the log messages but there won't be any until the user turns them on. This relates to #12523.

@dhruvmanila
Copy link
Member

Regardless, I don't see any specific location in the message:

2024-08-21 14:57:09.926 [info] [Trace - 2:57:09 PM]   29.078199584s ERROR ThreadId(42) ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml

Although it is visible when I run it from the command-line:

ruff check .                         
ruff failed
  Cause: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml
  Cause: TOML parse error at line 1, column 1
  |
1 | [tool.ruff.lint]
  | ^^^^^^^^^^^^^^^^
Unknown rule selector: `ME102`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants