Description
In closing #27218 (I think for Dart 2.9) we changed the behavior of // ignore:
comments such that they could no longer suppress "errors" or "warnings" (defined by the language specification); they could only ignore "hints" (like unused_import
) or "lints."
The initial idea was that nothing good can come from // ignore
-ing a compile-time error, and a user may be confused about what // ignore
does if not suppress the error at runtime as well.
The change was ultimately made so that security-motivated lint rules could be written and could not be ignored. The SecurityLintCode
class makes use of un-ignorability. Lint rules like unsafe_html use this. This feature means that developers cannot ignore a security-motivated lint rule inline.
The big problem which has arisen since closing #27218 is that the analyzer is not infallible. If the analyzer reports a false positive error diagnostic, the developer can do nothing inline to suppress that erroneous diagnostic. They can bulk ignore the diagnostic code in an analysis_options.yaml
file, but not file-by-file. This problem is big because of CI systems. Generally a CI bot/queue/configuration is red or green. If a code repository has one false positive static analysis diagnostic, then the "analyze" bot/queue/configuration is just red.
I think the analyzer team should revisit un-ignorable errors, and likely reduce the concept to just un-ignorable security-motivated lints.