astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
945 stars 45 forks source link

Extension is showing warnings about configuration issues in pyproject.toml files in a .venv #478

Closed LaurensBosscher closed 1 month ago

LaurensBosscher commented 1 month ago

Hi,

I've enabled the new Ruff LSP and I saw the following output in the logs:

2024-05-23 14:08:07.128 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the lint section. Please update the following options in /home/laurens/develop/savex/connectors/Bloomberg/.venv/lib/python3.12/site-packages/pandas/pyproject.toml:

  • 'ignore' -> 'lint.ignore'
  • 'select' -> 'lint.select'
  • 'typing-modules' -> 'lint.typing-modules'
  • 'unfixable' -> 'lint.unfixable'
  • 'per-file-ignores' -> 'lint.per-file-ignores' warning: The top-level linter settings are deprecated in favour of their counterparts in the lint section. Please update the following options in /home/laurens/develop/savex/connectors/InteractiveBrokers/.venv/lib/python3.12/site-packages/pandas/pyproject.toml:
  • 'ignore' -> 'lint.ignore'
  • 'select' -> 'lint.select'
  • 'typing-modules' -> 'lint.typing-modules'
  • 'unfixable' -> 'lint.unfixable'
  • 'per-file-ignores' -> 'lint.per-file-ignores'

A quick look at the pandas repo does show that they should indeed update their pyproject.toml however as a user this information is not actionable or relevant.

Since we're using a mono-repo with a number of installation of pandas this does create a bit of noise but is otherwise not an issue.

To reproduce:

  1. Install pandas
  2. Enable the new Ruff LSP
  3. Check the Output panel for Ruff.
charliermarsh commented 1 month ago

Does this only appear when you open a file in Pandas, like Go-To Definition into Pandas itself? Or always?

charliermarsh commented 1 month ago

(Agree we shouldn't show you this.)

LaurensBosscher commented 1 month ago

Does this only appear when you open a file in Pandas, like Go-To Definition into Pandas itself? Or always?

This shows up when I open the mono-repo project (w/h opening any files in the VSCode window) so it seems to be triggered by the initialization phase. I've attached the start of the log (after opening the project) below:

2024-05-24 14:39:15.052 [info] Name: Ruff
2024-05-24 14:39:15.052 [info] Module: ruff
2024-05-24 14:39:15.052 [info] Python extension loading
2024-05-24 14:39:15.052 [info] Waiting for interpreter from python extension.
2024-05-24 14:39:17.406 [info] Python extension loaded
2024-05-24 14:39:33.429 [info] Server run command: c:\Users\lbo\.pyenv\pyenv-win\versions\3.11.6\python.exe c:\Users\lbo\.vscode\extensions\charliermarsh.ruff-2024.22.0-win32-x64\bundled\tool\ruff_server.py server --preview
2024-05-24 14:39:33.432 [info] Server: Start requested.
2024-05-24 14:39:37.394 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `c:\develop\savex\projects\bridge\.venv\Lib\site-packages\pandas\pyproject.toml`:
  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'typing-modules' -> 'lint.typing-modules'
  - 'unfixable' -> 'lint.unfixable'
  - 'per-file-ignores' -> 'lint.per-file-ignores'

2024-05-24 14:39:37.395 [info] warning: `PGH001` has been remapped to `S307`.

2024-05-24 14:39:39.417 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `c:\develop\savex\projects\risk_framework\.venv\Lib\site-packages\pandas\pyproject.toml`:
  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'typing-modules' -> 'lint.typing-modules'
  - 'unfixable' -> 'lint.unfixable'
  - 'per-file-ignores' -> 'lint.per-file-ignores'

2024-05-24 14:39:41.234 [info] warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `c:\develop\savex\projects\risk_transfer_opportunities_backtester\.venv\Lib\site-packages\pandas\pyproject.toml`:
  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'typing-modules' -> 'lint.typing-modules'
  - 'unfixable' -> 'lint.unfixable'
  - 'per-file-ignores' -> 'lint.per-file-ignores'

The above statement is repeated for every project, then it shows the following lines:

2024-05-24 14:39:56.018 [info] [Trace - 2:39:55 PM] Received request 'client/registerCapability - (1)'.
2024-05-24 14:39:56.018 [info] [Trace - 2:39:55 PM] Sending response 'client/registerCapability - (1)'. Processing request took 3ms
2024-05-24 14:39:56.069 [info]   20.325423s INFO ruff_server::server Configuration file watcher successfully registered

Let me know if additional information is useful!

charliermarsh commented 1 month ago

Thanks, I see the issue. We proactively discover all configuration files, and we're not respecting exclusions.

charliermarsh commented 1 month ago

Fixed in https://github.com/astral-sh/ruff/pull/11551.