ruff/crates
Brent Westbrook 74a4e9af3d
Combine lint and syntax error handling (#18471)
## Summary

This is a spin-off from
https://github.com/astral-sh/ruff/pull/18447#discussion_r2125844669 to
avoid using `Message::noqa_code` to differentiate between lints and
syntax errors. I went through all of the calls on `main` and on the
branch from #18447, and the instance in `ruff_server` noted in the
linked comment was actually the primary place where this was being done.
Other calls to `noqa_code` are typically some variation of
`message.noqa_code().map_or(String::new, format!(...))`, with the major
exception of the gitlab output format:


a120610b5b/crates/ruff_linter/src/message/gitlab.rs (L93-L105)

which obviously assumes that `None` means syntax error. A simple fix
here would be to use `message.name()` for `check_name` instead of the
noqa code, but I'm not sure how breaking that would be. This could just
be:

```rust
 let description = message.body();
 let description = description.strip_prefix("SyntaxError: ").unwrap_or(description).to_string();
 let check_name = message.name();
```

In that case. This sounds reasonable based on the [Code Quality report
format](https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format)
docs:

> | Name | Type | Description|
> |-----|-----|----|
> |`check_name` | String | A unique name representing the check, or
rule, associated with this violation. |

## Test Plan

Existing tests
2025-06-05 12:50:02 +00:00
..
ruff [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ruff_annotate_snippets Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_benchmark [ty] Add --config-file CLI arg (#18083) 2025-05-27 08:00:38 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db Update salsa past generational id change (#18362) 2025-05-30 15:31:33 +02:00
ruff_dev Add a `ViolationMetadata::rule` method (#18234) 2025-05-28 09:27:09 -04:00
ruff_diagnostics Add a `ViolationMetadata::rule` method (#18234) 2025-05-28 09:27:09 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ruff_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_linter [`pyupgrade`] Make fix unsafe if it deletes comments (`UP050`) (#18390) 2025-06-03 09:10:15 -04:00
ruff_macros Add a `ViolationMetadata::rule` method (#18234) 2025-05-28 09:27:09 -04:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
ruff_python_ast Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_ast_integration_tests Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_codegen Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_formatter Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_literal Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_parser Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_resolver Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_semantic Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Add `offset` method to `ruff_python_trivia::Cursor` (#18371) 2025-05-29 16:08:15 +01:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Combine lint and syntax error handling (#18471) 2025-06-05 12:50:02 +00:00
ruff_source_file Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_text_size Add rustfmt.toml file (#18197) 2025-05-19 11:40:58 -04:00
ruff_wasm Combine lint and syntax error handling (#18471) 2025-06-05 12:50:02 +00:00
ruff_workspace Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ty_ide [ty] IDE: only provide declarations and bindings as completions (#18456) 2025-06-04 16:11:05 +02:00
ty_project [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ty_python_semantic [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ty_server [ty] Fix server hang after shutdown request (#18414) 2025-06-02 06:57:51 +00:00
ty_test [ty] Fix `--python` argument for Windows, and improve error messages for bad `--python` arguments (#18457) 2025-06-05 08:19:15 +01:00
ty_vendored Sync vendored typeshed stubs (#18407) 2025-06-01 15:21:18 +01:00
ty_wasm Use ty's completions in playground (#18425) 2025-06-03 10:11:39 +02:00