e4868ca176
Currently, diagnostic codes associated with lints are named using `lower_snake_case`, while analyzer diagnonstic codes are named using `UPPER_SNAKE_CASE`. However, when the analyzer builds instances of the `ErrorProcessor` class, it always uses `UPPER_SNAKE_CASE` names. Some pieces of logic that matched up `ErrorProcessor`s to diagnostic codes accounted for this difference; others didn't. This led to a some buggy behaviors: - If an instance of `ErrorProcessor` got constructed outside of the analyzer (by an analyzer client using the analyzer public API), and it supplied a `lower_snake_case` name, then `ErrorProcessor.appliesTo` would only successfully match if the name referred to a lint. - The resolved correction producer base class `_BaseIgnoreDiagnostic` (which forms the basis for the quick fixes "Ignore '...' in `analysis_options.yaml`", "Ignore '...' for this line", and "Ignore '...' for the whole file") would only notice that a diagnostic was unignorable if the case matched exactly. In practice, this meant that when operating on instances of `ErrorProcessor` created by the analyzer, it wouldn't properly handle lints. These buggy behaviors have been fixed by: - Changing the `ErrorProcessor` constructor to always convert the `code` to lower case. - Changing all references to `ErrorProcessor.code` to assume lower case. Change-Id: I6a6a69645284f646e0c070fc2b55c4a90203d74a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462863 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
analysis_server_plugin package
This package offers support for writing Dart analysis server plugins, for Dart 3.10 (Flutter 3.38) and later.
Analysis server plugins empower developers to contribute their own Dart static
analysis in IDEs and at the command line via dart analyze and flutter analyze. Analysis server plugins can offer the following static analyses:
- analysis rules, which report diagnostics in the IDE, and at the command line
- IDE quick fixes, which are local refactorings offered to users to correct a given diagnostic
- IDE quick assists, which are local refactorings that are offered at specific syntax nodes in code, but do not necessarily correct a static code issue
Review the following documents for how to write and how to use analysis server plugins: