Consistently wrap tokens in parser diagnostics in backticks instead of 'quotes'#21163
Merged
Gankra merged 1 commit intoastral-sh:mainfrom Oct 31, 2025
Merged
Consistently wrap tokens in parser diagnostics in backticks instead of 'quotes'#21163Gankra merged 1 commit intoastral-sh:mainfrom
backticks instead of 'quotes'#21163Gankra merged 1 commit intoastral-sh:mainfrom
Conversation
The parser currently uses single quotes to wrap tokens. This is inconsistent with the rest of ruff/ty, which use backticks. For example, see the inconsistent diagnostics produced in this simple example: https://play.ty.dev/0a9d6eab-6599-4a1d-8e40-032091f7f50f Consistently wrapping tokens in backticks produces uniform diagnostics. Following astral-sh#723, in astral-sh#2889 some quotes were already switched into backticks. This is also in line with Rust's guide on diagnostics (https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure): > When code or an identifier must appear in a message or label, it should be surrounded with backticks
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| invalid-syntax: | 28 | 14 | 14 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+1843 -1843 violations, +0 -0 fixes in 9 projects; 46 projects unchanged)
apache/airflow (+7 -7 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- airflow-core/src/airflow/operators/__init__.py:30:13: E231 [*] Missing whitespace after ':' + airflow-core/src/airflow/operators/__init__.py:30:13: E231 [*] Missing whitespace after `:` - airflow-core/src/airflow/operators/__init__.py:40:11: E231 [*] Missing whitespace after ':' + airflow-core/src/airflow/operators/__init__.py:40:11: E231 [*] Missing whitespace after `:` - airflow-core/src/airflow/operators/__init__.py:43:15: E231 [*] Missing whitespace after ':' + airflow-core/src/airflow/operators/__init__.py:43:15: E231 [*] Missing whitespace after `:` - airflow-core/src/airflow/operators/__init__.py:67:13: E231 [*] Missing whitespace after ':' + airflow-core/src/airflow/operators/__init__.py:67:13: E231 [*] Missing whitespace after `:` - airflow-core/src/airflow/sensors/__init__.py:35:13: E231 [*] Missing whitespace after ':' + airflow-core/src/airflow/sensors/__init__.py:35:13: E231 [*] Missing whitespace after `:` ... 4 additional changes omitted for project
aws/aws-sam-cli (+8 -8 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- tests/integration/buildcmd/test_build_cmd.py:1030:39: E231 [*] Missing whitespace after ',' + tests/integration/buildcmd/test_build_cmd.py:1030:39: E231 [*] Missing whitespace after `,` - tests/integration/buildcmd/test_build_cmd.py:1755:39: E231 [*] Missing whitespace after ',' + tests/integration/buildcmd/test_build_cmd.py:1755:39: E231 [*] Missing whitespace after `,` - tests/integration/local/start_api/test_start_api.py:2386:40: E231 [*] Missing whitespace after ',' + tests/integration/local/start_api/test_start_api.py:2386:40: E231 [*] Missing whitespace after `,` - tests/integration/local/start_api/test_start_api.py:2405:40: E231 [*] Missing whitespace after ',' + tests/integration/local/start_api/test_start_api.py:2405:40: E231 [*] Missing whitespace after `,` - tests/integration/local/start_api/test_start_api.py:2424:40: E231 [*] Missing whitespace after ',' + tests/integration/local/start_api/test_start_api.py:2424:40: E231 [*] Missing whitespace after `,` ... 6 additional changes omitted for project
binary-husky/gpt_academic (+508 -508 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- config.py:307:39: E231 [*] Missing whitespace after ',' + config.py:307:39: E231 [*] Missing whitespace after `,` - config.py:307:75: E231 [*] Missing whitespace after ',' + config.py:307:75: E231 [*] Missing whitespace after `,` - config.py:308:40: E231 [*] Missing whitespace after ',' + config.py:308:40: E231 [*] Missing whitespace after `,` - config.py:314:80: E231 [*] Missing whitespace after ',' + config.py:314:80: E231 [*] Missing whitespace after `,` - config.py:351:85: E231 [*] Missing whitespace after ',' + config.py:351:85: E231 [*] Missing whitespace after `,` - crazy_functions/Conversation_To_File.py:227:36: E231 [*] Missing whitespace after ':' + crazy_functions/Conversation_To_File.py:227:36: E231 [*] Missing whitespace after `:` - crazy_functions/Document_Conversation_Wrap.py:31:47: E231 [*] Missing whitespace after ':' ... 1003 additional changes omitted for project
bokeh/bokeh (+1213 -1213 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- examples/advanced/extensions/tool.py:80:25: E231 [*] Missing whitespace after ',' + examples/advanced/extensions/tool.py:80:25: E231 [*] Missing whitespace after `,` - examples/advanced/extensions/tool.py:80:41: E231 [*] Missing whitespace after ',' + examples/advanced/extensions/tool.py:80:41: E231 [*] Missing whitespace after `,` - examples/basic/annotations/arrowheads.py:17:27: E231 [*] Missing whitespace after ',' + examples/basic/annotations/arrowheads.py:17:27: E231 [*] Missing whitespace after `,` - examples/basic/annotations/colorbar_log.py:25:25: E231 [*] Missing whitespace after ',' + examples/basic/annotations/colorbar_log.py:25:25: E231 [*] Missing whitespace after `,` - examples/basic/annotations/colorbar_log.py:25:40: E231 [*] Missing whitespace after ',' + examples/basic/annotations/colorbar_log.py:25:40: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:21: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:21: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:23: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:23: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:30: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:30: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:32: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:32: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:41: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:41: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:43: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:43: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:50: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:50: E231 [*] Missing whitespace after `,` - examples/basic/annotations/legends_multi_index.py:6:52: E231 [*] Missing whitespace after ',' + examples/basic/annotations/legends_multi_index.py:6:52: E231 [*] Missing whitespace after `,` - examples/basic/annotations/title_additional.py:7:12: E231 [*] Missing whitespace after ',' + examples/basic/annotations/title_additional.py:7:12: E231 [*] Missing whitespace after `,` - examples/basic/annotations/title_additional.py:7:19: E231 [*] Missing whitespace after ',' + examples/basic/annotations/title_additional.py:7:19: E231 [*] Missing whitespace after `,` - examples/basic/annotations/title_basic.py:5:12: E231 [*] Missing whitespace after ',' + examples/basic/annotations/title_basic.py:5:12: E231 [*] Missing whitespace after `,` ... 2394 additional changes omitted for project
fronzbot/blinkpy (+22 -22 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- blinksync/blinksync.py:94:103: E231 [*] Missing whitespace after ',' + blinksync/blinksync.py:94:103: E231 [*] Missing whitespace after `,` - blinksync/forms.py:117:35: E231 [*] Missing whitespace after ':' + blinksync/forms.py:117:35: E231 [*] Missing whitespace after `:` - blinksync/forms.py:117:51: E231 [*] Missing whitespace after ',' + blinksync/forms.py:117:51: E231 [*] Missing whitespace after `,` - blinksync/forms.py:117:62: E231 [*] Missing whitespace after ':' + blinksync/forms.py:117:62: E231 [*] Missing whitespace after `:` - blinksync/forms.py:11:22: E231 [*] Missing whitespace after ',' + blinksync/forms.py:11:22: E231 [*] Missing whitespace after `,` ... 34 additional changes omitted for project
milvus-io/pymilvus (+68 -68 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- examples/alter.py:34:105: E231 [*] Missing whitespace after ':' + examples/alter.py:34:105: E231 [*] Missing whitespace after `:` - examples/alter.py:34:53: E231 [*] Missing whitespace after ',' + examples/alter.py:34:53: E231 [*] Missing whitespace after `,` - examples/alter.py:35:52: E231 [*] Missing whitespace after ',' + examples/alter.py:35:52: E231 [*] Missing whitespace after `,` - examples/alter.py:36:101: E231 [*] Missing whitespace after ':' + examples/alter.py:36:101: E231 [*] Missing whitespace after `:` - examples/alter.py:36:106: E231 [*] Missing whitespace after ',' + examples/alter.py:36:106: E231 [*] Missing whitespace after `,` ... 126 additional changes omitted for project
mlflow/mlflow (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- mlflow/types/llm.py:829:42: E231 [*] Missing whitespace after ',' + mlflow/types/llm.py:829:42: E231 [*] Missing whitespace after `,`
openai/openai-cookbook (+14 -14 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select A,E703,F704,B015,B018,D100
- examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:11: invalid-syntax: Expected ',', found name + examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:11: invalid-syntax: Expected `,`, found name - examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:16: invalid-syntax: Expected ',', found '=' + examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:16: invalid-syntax: Expected `,`, found `=` - examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:22: invalid-syntax: Expected ',', found name + examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:22: invalid-syntax: Expected `,`, found name - examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:24: invalid-syntax: Expected ',', found ';' + examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:10:24: invalid-syntax: Expected `,`, found `;` - examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:11:27: invalid-syntax: Expected ',', found '=' + examples/mcp/databricks_mcp_cookbook.ipynb:cell 30:11:27: invalid-syntax: Expected `,`, found `=` ... 18 additional changes omitted for project
... Truncated remaining completed project reports due to GitHub comment length restrictions
Changes by rule (2 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| E231 | 3658 | 1829 | 1829 | 0 | 0 |
| invalid-syntax: | 28 | 14 | 14 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
backticks instead of 'quotes'
backticks instead of 'quotes'backticks\ instead of 'quotes'
backticks\ instead of 'quotes'backticks instead of 'quotes'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The parser currently uses single quotes to wrap tokens. This is inconsistent with the rest of ruff/ty, which use backticks.
For example, see the inconsistent diagnostics produced in this simple example: https://play.ty.dev/0a9d6eab-6599-4a1d-8e40-032091f7f50f
Consistently wrapping tokens in backticks produces uniform diagnostics. Following the style decision of #723, in #2889 some quotes were already switched into backticks.
This is also in line with Rust's guide on diagnostics (https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure):