astral-sh / ruff-vscode

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

Ruff-specific array-like settings can be unintuitive when set in the extension #491

Open snowsignal opened 4 weeks ago

snowsignal commented 4 weeks ago

Ruff version: v0.4.8 Extension version: 2024.26.0

Let's say you have a Lint > Select setting that looks like this:

Screenshot 2024-06-05 at 4 21 32 PM

which is equivalent to:

[tool.ruff.lint]
select = []

Notably, this is different from the default Lint > Select setting, which is this:

Screenshot 2024-06-05 at 4 21 47 PM

which leaves select without a value, instead of setting it to [].

This subtle difference means that if you remove all entries from Lint > Select but then forget to 'reset' the setting, you've turned off all lint rules, and may not have even realized it.

Ideally, the difference between null and [] for select and other "array-like" settings should be more clear.