-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The different "types" of diagnostics that the analyzer (and CFE?) can report exist as classes (like LintCode, ParserErrorCode, TodoCode, StaticWarningCode, CompileTimeErrorCode, WarningCode, ScannerErrorCode, AnalysisOptionsErrorCode, AnalysisOptionsWarningCode, etc), which all have a common super-class: ErrorCode.
This name is potentially confusing, as we can say, for example "using a @visibleForTesting element outside of a test does not yield an error; it yields a warning." But warning is a subclass of error? For years this confusion would only hamper the developers of the analyzer (and CFE?). But the new analyzer plugin system uses LintCode and WarningCode, and we need a better name for the shared super-class, for function signatures, etc.
I propose DiagnosticCode. It's longer, more syllables, but it is not a name that will be used often.
We can do a gentle incremental migration, and there is no rush to delete ErrorCode:
- Add a type alias,
typedef DiagnosticCode = ErrorCode. - Change function signatures in API that will become public for analyzer plugins.
Then, as needed, as time permits:
- Migrate internal usage to
DiagnosticCode. - Deprecate
ErrorCode. - In a major version release, without any rush, rename
ErrorCodetoDiagnosticCodeand remove the type alias.