Skip to content
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

dartanalyzer (internal testing tool) --json does not respect diagnostic suppression #50757

Closed
srawlins opened this issue Dec 16, 2022 · 1 comment
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@srawlins
Copy link
Member

If I place a analysis_options.yaml file in the root of the Dart SDK repo like this:

analyzer:
  errors:
    deprecated_subtype_of_function: ignore
    unused_import: ignore
    unused_local_variable: ignore

and build the dartanalyzer tool, which is used by tools/test.py, and run this command, I see errors which should be suppressed:

$ DART_CONFIGURATION=ReleaseX64 xcodebuild/ReleaseX64/dart-sdk/bin/dart xcodebuild/ReleaseX64/gen/dartanalyzer.dart.snapshot -Dtest_runner.configuration=analyzer-mac --ignore-unrecognized-flags --packages=/Users/srawlins/code/dart-sdk/sdk/.dart_tool/package_config.json --format=json   /Users/srawlins/code/dart-sdk/sdk/xcodebuild/ReleaseX64/generated_tests/language_2/call/method_as_cast_test_01.dart

{"version":1,"diagnostics":[{"code":"deprecated_subtype_of_function","severity":"WARNING","type":"STATIC_WARNING","location":{"file":"/Users/srawlins/code/dart-sdk/sdk/xcodebuild/ReleaseX64/generated_tests/language_2/call/method_as_cast_test_01.dart","range":{"start":{"offset":387,"line":16,"column":20},"end":{"offset":395,"line":16,"column":28}}},"problemMessage":"Implementing 'Function' has no effect.","correctionMessage":"Try removing 'Function' from the 'implements' clause.","documentation":"https://dart.dev/diagnostics/deprecated_subtype_of_function"},{"code":"unused_local_variable","severity":"INFO","type":"HINT","location":{"file":"/Users/srawlins/code/dart-sdk/sdk/xcodebuild/ReleaseX64/generated_tests/language_2/call/method_as_cast_test_01.dart","range":{"start":{"offset":756,"line":33,"column":5},"end":{"offset":757,"line":33,"column":6}}},"problemMessage":"The value of the local variable 'd' isn't used.","correctionMessage":"Try removing the variable or using it.","documentation":"https://dart.dev/diagnostics/unused_local_variable"}]}

But if I remove the --format=json, we see the errors correctly suppressed:

$ DART_CONFIGURATION=ReleaseX64 xcodebuild/ReleaseX64/dart-sdk/bin/dart xcodebuild/ReleaseX64/gen/dartanalyzer.dart.snapshot -Dtest_runner.configuration=analyzer-mac --ignore-unrecognized-flags --packages=/Users/srawlins/code/dart-sdk/sdk/.dart_tool/package_config.json /Users/srawlins/code/dart-sdk/sdk/xcodebuild/ReleaseX64/generated_tests/language_2/call/method_as_cast_test_01.dart
Analyzing /Users/srawlins/code/dart-sdk/sdk/xcodebuild/ReleaseX64/generated_tests/language_2/call/method_as_cast_test_01.dart...
No issues found!
@srawlins srawlins added P1 A high priority bug; for example, a single project is unusable or has many test failures area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Dec 16, 2022
@srawlins
Copy link
Member Author

p1 because this is blocking the migration away from Hints.

@srawlins srawlins self-assigned this Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant