mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 05:51:03 -05:00
## Summary Related to https://github.com/astral-sh/ruff-vscode/issues/571, this PR updates the settings index builder to trace all the errors it encountered. Without this, there's no way for user to know that something failed and some of the capability might not work as expected. For example, in the linked PR, the settings were invalid which means notebooks weren't included and there were no log messages for it. ## Test Plan Create an invalid `ruff.toml` file: ```toml [tool.ruff] extend-exclude = ["*.ipynb"] ``` Logs: ``` 2024-08-12 18:33:09.873 [info] [Trace - 6:33:09 PM] 12.217043000s ERROR ruff:main ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml ``` Notification Preview: <img width="483" alt="Screenshot 2024-08-12 at 18 33 20" src="https://github.com/user-attachments/assets/a4f303e5-f073-454f-bdcd-ba6af511e232"> Another way to trigger is to provide an invalid `cache-dir` value: ```toml [tool.ruff] cache-dir = "$UNKNOWN" ``` Same notification preview but different log message: ``` 2024-08-12 18:41:37.571 [info] [Trace - 6:41:37 PM] 21.700112208s ERROR ThreadId(30) ruff_server::session::index::ruff_settings: Error while resolving settings from /Users/dhruv/playground/ruff/pyproject.toml: Invalid `cache-dir` value: error looking key 'UNKNOWN' up: environment variable not found ``` With multiple `pyproject.toml` file: ``` 2024-08-12 18:41:15.887 [info] [Trace - 6:41:15 PM] 0.016636833s ERROR ThreadId(04) ruff_server::session::index::ruff_settings: Error while resolving settings from /Users/dhruv/playground/ruff/pyproject.toml: Invalid `cache-dir` value: error looking key 'UNKNOWN' up: environment variable not found 2024-08-12 18:41:15.888 [info] [Trace - 6:41:15 PM] 0.017378833s ERROR ThreadId(13) ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/tools/pyproject.toml ```