-
Notifications
You must be signed in to change notification settings - Fork 31
refactor: unify LintingResult and Formatter APIs #1568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Benchmark for 35acae2Click to view benchmark
|
Benchmark for f9cb68eClick to view benchmark
|
601bd51
to
28022fd
Compare
Benchmark for 4655a09Click to view benchmark
|
28022fd
to
aed4fd3
Compare
Benchmark for de62ed4Click to view benchmark
|
4025609
to
aa887f2
Compare
Benchmark for 50edd6aClick to view benchmark
|
Benchmark for cfcf121Click to view benchmark
|
e8414d6
to
aa887f2
Compare
aa887f2
to
80a07e7
Compare
Benchmark for bea2fd3Click to view benchmark
|
Benchmark for 73afa82Click to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the APIs for handling linting results and formatter outputs. It unifies the interfaces by replacing uses of get_violations with violations or into_violations, updates method signatures (e.g. dispatch_file_violations and completion_message), and adjusts tests and callers accordingly.
- Updated API usage for linting results and violation collection
- Refactored formatter interfaces and test assertions
- Unified methods across linter, CLI, and WASM integrations
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
crates/lsp/src/lib.rs | Updated violation extraction by using into_violations() |
crates/lib/tests/rules.rs | Renamed variables and updated assertions to call violations() |
crates/lib/src/core/rules/noqa.rs | Replaced get_violations calls with violations() |
crates/lib/src/core/linter/linting_result.rs | Refactored to use a new() constructor and added an IntoIterator implementation |
crates/lib/src/core/linter/linted_file.rs | Updated violation API; added accessor methods and sorting in new() |
crates/lib/src/core/linter/core.rs | Refactored instantiation of LintedFile and updated violation dispatch |
crates/lib/src/cli/json.rs | Updated to use violations() and the accessor for path |
crates/lib/src/cli/github_annotation_native_formatter.rs | Updated violation dispatch using violation.rule_code() and the new API |
crates/lib/src/cli/formatters.rs | Adjusted formatter interface methods and test expectations |
crates/lib-wasm/src/lib.rs | Refactored diagnostic construction to use immutable violation references |
crates/cli-lib/src/commands_lint.rs | Updated invocation of completion_message with file count parameter |
crates/cli-lib/src/commands_fix.rs | Streamlined fix logic by using new violation handling API |
Files not reviewed (2)
- crates/cli-python/tests/json/test_fail_whitespace_before_comma.stdout: Language not supported
- crates/cli/tests/json/test_fail_whitespace_before_comma.stdout: Language not supported
No description provided.