35ce26e0db
This adds checks for three cases: - error codes for diagnostics that are not being produced, - error codes that can't be ignored (with a severity of error), and - error codes that are already being ignored. I originally also checked for names that are not defined as error codes (which turned up at least one valid issue in the Flutter repo), but we don't have a list of all valid names against which to compare because plugins can add new diagnostics. It should be noted that, as written, these diagnostics can't be ignored, despite being hints. The reason is as follows: in order to detect diagnostics that are not being produced, these checks need to have a list of the diagnostics that _are_ produced. If an ignore comment attempted to ignore one of these hints, this validation would occur before the hint had been generated, so that comment would in turn appear to be unnecessary. If we need them to be ignorable, then we can special case them so that they are never reported as being unnecessary. And after running this over the Flutter repo I commented out two of the three codes because there are violations. Many of the violations are valid and need to be cleaned up. Some are the result of "ignore" being used for other purposes. The Flutter team has said that we can replace their use of "ignore" in order to enable these hints, but I don't have time to do that right now and I'd like to get this landed before it bit rots again. Change-Id: I1704105621bef5a5c49202267c99aa1d950a26a9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156402 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>