-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Remove the "Hint" diagnostic category #50796
Comments
Kind of a minor nit, but I consider We didn't always choose the classes based on severity, sometimes it had more to do with where the diagnostics are being generated or who owns the codes. That said, what's important here is not which classes we used in the implementation, but the impact of changing the severities of some of our enabled-by-default diagnostics. |
I would consider two things: enablement-by-default, and number of managed A compile-time error (and similar) is an error, and the user would like to see this as early as possible to be fixed. There is no value to disable it, I guess, since the error will surely come later, either during compilation or at run-time. Moving the current hints (around 127) to lints will make the user be overwhelmed by the number of diagnostics which are One of the decisions the formatter took, is to almost disable configuration, so whatever the formatter team decides, everyone follows. The only option is to turn on/off the formatter, life is easy and simple. Let's compare Personally, I believe "less is more", and as the language evolves, I guess there is no need to let the users still use the old ways for long time (using From the high-level, the user chould have three sets of configurable diagnostics (restrictive/all, medium, low/none). The total number of the configurable diagnostics should not be high (I would say somewhere around 100, if not less). Anything which isn't really needed to be configured, should be non-configurable by default. Configuring every diagnostic is ok, but seeing hundreds of non-categorized diagnostics is not very user-friendly. |
@asashour I think we agree.
I agree. Note that I wrote:
@bwilkerson wrote up a comprehensive list, and I think it is an extreme minority of "hints" which we may rewrite as "lints." Less than 10. Examples are |
Can we put that list somewhere (e.g. in a markdown gist) and link it from this issue? That would make it easier to understand the implications of this proposed change. |
@mit-mit I believe @bwilkerson shared these with you offline. We could move it into a public gist. The internal doc just has lots of discussion. |
In dartfuzz_api_table.dart, both `DartType.VOID` and `DartType.VOID_NULLABLE` are added to the Map keys. At runtime, the last value for a given key wins, so I removed the `DartType.VOID` key-value pair. In gen_api_table.dart, both `assertionErrorEncoding` and `errorEncoding` are added to the Map keys. At runtime, the last value for a given key wins, so I removed the `assertionErrorEncoding` key-value pair. This CL should be a no-op. Bug: #50796 Change-Id: Ifcfeb3e84930267f60efd2eb009a722f8ac2453e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279234 Reviewed-by: Tess Strickland <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Rename StaticWarningCode to WarningCode, leaving the spec ones as StaticWarningCode. In this CL I do not introduce a new "type" for WarningCode, it is still "STATIC_WARNING". Later, we can make a new type, "WARNING", taking care for pkg/test_runner and DAS clients like IntelliJ. Bug: #50796 Change-Id: Ife856b2beb7e9b6bf8203f365634f49846d03bf1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278997 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: Id07ac5940eafed58b1473804248381dd933cb311 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279229 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
Bug: #50796 Change-Id: Ifa01985beba01298addacf58b576b049ce0918f5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279322 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
This is required in order to migrate Hints to Warnings This CL migrates this code: https://dart-review.googlesource.com/c/sdk/+/279443 TESTED=presubmit Bug: #50796 Change-Id: I1e0c360e6ed366b6452474338679acc8b1e1399c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279458 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
Bug: #50796 Change-Id: I74625c25f947178b24d3374b0e87d7c89c3b20ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279332 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
This reverts commit b2c26d0. Reason for revert: linter references this HintCode. Original change's description: > [analyzer] Move 4 more Hints to Warnings, OVERRIDE_ON_* > > Bug: #50796 > Change-Id: I74625c25f947178b24d3374b0e87d7c89c3b20ba > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279332 > Reviewed-by: Konstantin Shcheglov <[email protected]> > Commit-Queue: Samuel Rawlins <[email protected]> [email protected],[email protected],[email protected] Change-Id: I6f786ae0ebb3727a3eac0c3fdb39523a96d3525a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: #50796 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279660 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
Bug: #50796 Change-Id: Id8b53ebef2b44d6fe1a436edf796056f60913024 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279443 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
This requires introducing the notion of a code alias, into the code generator. These 10 HintCodes are referenced directly by the linter, and so must be migrated to WarningCodes incrementally. Bug: #50796 Change-Id: I9223986cb198cb87cec74646ef20c3020c019fdd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279472 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: Ic46261738fbbd5d0e78a60b520283ea38a28b22b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280063 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Progress: In early December there were 140 HintCodes. Today there are 109 HintCodes, and 35 WarningCodes. |
Bug: #50796 Change-Id: Ia9612f618e2b8e7695ad98bb6b347320d4944efd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280077 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: I116c957801ab873f2c7bb725008daf80564e7526 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280133 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
`NULLABLE_TYPE_IN_CATCH_CLAUSE` is becoming a warning, so these must be fixed (or ignored). TEST=presubmit Bug: #50796 Change-Id: I8343f3e1f49ed3c05dcf2d99a98cef8a953afc7d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280563 Auto-Submit: Samuel Rawlins <[email protected]> Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: I7f2364a4afedd59d481216b37836b46ce5638866 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280403 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: I949e1f691889ac5a5ff4181b708cfe9e0bb1e1ca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281303 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: I904b38bbab62800ce2ecb8435d6a1048362e189e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281340 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: Ifd52af7553f4a90a536cafb79584ffc0fa623407 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281741 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
This contains fixes for moving STRICT_RAW_TYPE to a Warning, for dart-lang/sdk#50796.
Bug: #50796 Change-Id: I11d1ad107d8da147dd05329938bbe34325dfbb77 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289341 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
…_CHECK*, STRICT_RAW_TYPE Bug: #50796 Change-Id: Idcac3ddb582e5b46263fd017c39402b1c11914d7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289447 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
This includes static analysis fixes required for DEAD_CODE to flip to a Warning, for dart-lang/sdk#50796
Bug: #50796 Change-Id: Ie7a6cb94cefaf4f551ed766e637bac3606c0f5ed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279463 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
Progress: Today there are 25 HintCodes, and 122 WarningCodes. |
I took care to leave code and comments which _does still_ refer to the remaining Hints. This CL is not super complete, but I think addresses most of the outdated text refering to Hints. I will do another round after migrating more to Warnings. Bug: #50796 Change-Id: Iab58dbbfbdef86e21dd65b2a96d8e34e3e7e54ff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290440 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
Bug: #50796 Change-Id: I71291bfa959d7553c64d4a9e1f2918892ae012eb TEST=trybots Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290403 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
We also stop reporting `HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` and `HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE` as these are now replaced by the new lint rule. The biggest change here is in the DEPRECATED_MEMBER_USE tests, as most of these tests have `DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` reported (since it's easier to write tests with files in one package). We move all of those tests to `DEPRECATED_MEMBER_USE` tests, without losing coverage. Bug: #50796 Change-Id: I7cada44265cd0e1e47ab77d4354de9a5571db614 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289444 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Kevin Moore <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
…nd completions. The presence of errors (and previously, warnings) affects what completions are offered (or their order?) and what fixes are offered (or their order?), and the order of re-analysis. When unused local variables and imports etc are WARNINGS, fixes, completions, and re-analysis should not regress. Bug: #50796 Change-Id: If5141eec7df01f50caee5bf245c031b5a51ea590 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291100 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: Ib5b153bc6e64bc433df1f05c53d82f71b470bbec TEST=presubmit bots Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290703 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
This reverts commit 0ef7ed2. Reason for revert: Tests are failing in google3 - linter needs to be bumped Original change's description: > [analyzer] Move 4 more HintCodes to be WarningCodes, UNUSED_* > > Bug: #50796 > Change-Id: Ib5b153bc6e64bc433df1f05c53d82f71b470bbec > TEST=presubmit bots > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290703 > Reviewed-by: Brian Wilkerson <[email protected]> > Reviewed-by: Alexander Aprelev <[email protected]> > Commit-Queue: Samuel Rawlins <[email protected]> > Reviewed-by: Nate Bosch <[email protected]> Bug: #50796 Change-Id: If1c460bdcf422033648417da5ba2f5fbc1b459c2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291460 Bot-Commit: Rubber Stamper <[email protected]> Auto-Submit: Oleh Prypin <[email protected]> Reviewed-by: Alexander Thomas <[email protected]> Commit-Queue: Alexander Thomas <[email protected]> Commit-Queue: Oleh Prypin <[email protected]>
This reverts commit e48f35b. Reason for revert: linter is fixed. Original change's description: > Revert "[analyzer] Move 4 more HintCodes to be WarningCodes, UNUSED_*" > > This reverts commit 0ef7ed2. > > Reason for revert: Tests are failing in google3 - linter needs to be bumped > > Original change's description: > > [analyzer] Move 4 more HintCodes to be WarningCodes, UNUSED_* > > > > Bug: #50796 > > Change-Id: Ib5b153bc6e64bc433df1f05c53d82f71b470bbec > > TEST=presubmit bots > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290703 > > Reviewed-by: Brian Wilkerson <[email protected]> > > Reviewed-by: Alexander Aprelev <[email protected]> > > Commit-Queue: Samuel Rawlins <[email protected]> > > Reviewed-by: Nate Bosch <[email protected]> > > Bug: #50796 > Change-Id: If1c460bdcf422033648417da5ba2f5fbc1b459c2 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291460 > Bot-Commit: Rubber Stamper <[email protected]> > Auto-Submit: Oleh Prypin <[email protected]> > Reviewed-by: Alexander Thomas <[email protected]> > Commit-Queue: Alexander Thomas <[email protected]> > Commit-Queue: Oleh Prypin <[email protected]> Bug: #50796 Change-Id: Ie503b57a19df1a50cb3dfe50c840d20779310e87 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291560 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Oleh Prypin <[email protected]> Reviewed-by: Nate Bosch <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]> Bot-Commit: Rubber Stamper <[email protected]>
Analyzer has changed an info to a warning. Test was looking for "info -" in output. The info category is quickly going away (q.v., dart-lang/sdk#50796), so the test should probably be checking for warnings now.
Don't extend something which should (and will) be an interface. Update a test expectation: Analyzer has changed an info to a warning. Test was looking for "info -" in output. The info category is quickly going away (q.v., dart-lang/sdk#50796), so the test should probably be checking for warnings now.
Progress: Today there are 19 HintCodes, and 135 WarningCodes. This is probably what is shipping in Dart 3.0. |
Bug: #50796 Change-Id: Iddcb1b6d035e9590600e6bfbd8d2133da39bcc35 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295803 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Bug: #50796 Change-Id: I7050b4f758976ff555e43f219c6f5c2b0e8d362a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290903 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
After this move, there are 10 remaining HintCodes: 3 are deprecated (only reported in pre Dart 3.0 code), 5 are to be moved; 2 are to be re-implemented as LintCodes. Work towards #50796 Change-Id: I230c1c6a4defcdf1a00c0a755eac71baa1d4c9bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324420 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
Work towards #50796 Change-Id: Idb8d04eb07beeb4f201ca69d0543d85305d62ea8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325127 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Auto-Submit: Samuel Rawlins <[email protected]>
These Hints and any subsequently unused quick fixes are deleted: * HintCode.CAN_BE_NULL_AFTER_NULL_AWARE * HintCode.IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE * HintCode.NULL_AWARE_BEFORE_OPERATOR * HintCode.NULL_AWARE_IN_CONDITION * HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR Work towards #50796 Change-Id: I1b9326ae3c83fcc6be7a7ba4a5f493fc08cc75be Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336321 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
* UNNECESSARY_CAST * UNUSED_ELEMENT * UNUSED_ELEMENT_PARAMETER * UNUSED_LOCAL_VARIABLE Work towards #50796 Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try Change-Id: I15c74e5ebc626f7e513c04013aa2f81b36ca39a8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377762 Reviewed-by: Nate Bosch <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
This is replaced by the use_truncating_division lint rule. Work towards #50796 Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try Change-Id: Ied034267f4f8e5ea70ed0b4a21c39e88c88240ec Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378574 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
And there are now 165 WarningCodes and 9 HintCodes. 4 are versions of "DEPRECATED_MEMBER_USE"; 2 are deprecated; the remaining are |
I'd be interested to get your input on |
Yes
I don't want to force macro authors into writing plugins any more than is necessary. It complicates things unnecessarily imo, both from a user experience perspective and a macro author perspective. |
Currently in the analyzer we have (approximately) the following diagnostic categories:
(There are others like ParserErrorCode, TodoCode, FfiCode, etc, but the 4 above are the common, user-visible ones.)
We'd like to remove the HintCode category, and move all "hints" to be either "warnings" or "lints." They will mostly be moved to "warnings."
The categories differ from each other in their default severity (one of
ERROR
,WARNING
, orINFO
), and whether they are reported by default (or must be enabled viaanalysis_options.yaml
):ERROR
WARNING
INFO
INFO
What do these mean, practically? The difference is primarily in the behavior of
dart analyze
(used in presubmit checks, continuous integration, and perhaps by humans):dart analyze
, its exit code is0
.INFO
-severity diagnostic report does not move the exit code away from0
.WARNING
-severity diagnostic report does move the exit code away from0
.ERROR
-severity diagnostic report does move the exit code away from0
.Note also:
WARNING
-severity diagnostics can be changed with the--[no-]fatal-warnings
flag.INFO
-severity diagnostics can be changed with the--[no-]fatal-infos
flag.DEAD_CODE
orUNUSED_IMPORT
or any lint rule) can be changed inanalysis_options.yaml
from its default to any of the others, orIGNORE
.This proposal is therefore a breaking change: "Hints" which are moved to be "warnings" will become fatal (by default) when reported by
dart analyze
. (Behavior will not change when--fatal-infos
or--no-fatal-warnings
is being used.)Another significant change: users will also no longer get the protection from a "hint" which is moved to be an opt-in "lint" unless they explicitly enable it in their
analysis_options.yaml
file (or include another analysis options file which does so).Historical note: We had more "static warnings" defined by the language in previous releases of Dart, but all but a handful of those have been dropped, and the language team has confirmed that it is "fair game" for tools like the analyzer to define their own "warnings."
The text was updated successfully, but these errors were encountered: