ruff
74a4e9af - Combine lint and syntax error handling (#18471)

Commit
324 days ago
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: https://github.com/astral-sh/ruff/blob/a120610b5b01a9e7bb91740a23f6c2b5bbcd4b5f/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
Author
Parents
Loading