Skip to content

[analyzer] how to use AnalysisOptionsFileConfig in testing analyzer_plugin #49987

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

Closed
asashour opened this issue Sep 19, 2022 · 3 comments
Closed
Labels
legacy-area-analyzer Use area-devexp instead.

Comments

@asashour
Copy link
Contributor

asashour commented Sep 19, 2022

I am trying to fix some part of #49559, and couldn't find a way to control analysis_options.yaml, so it is read by the test method.

In sdk/259720, writeTestPackageAnalysisOptionsFile writes the file, however resolvedUnit.session.analysisContext.analysisOptions.lintRules doesn't seem to pick the changes.

In analysis_server, there is a similar method, with TODO to use AnalysisOptionsFileConfig

/// Write an analysis options file based on the given arguments.
/// TODO(scheglov) Use AnalysisOptionsFileConfig
void _writeAnalysisOptionsFile({

so I understand the correct way is to use AnalysisOptionsFileConfig from the analyzer in

but I am not sure how this is possible to be called from the analyzer_plugin, since it is in test main folder, not in src

@mraleph mraleph added the legacy-area-analyzer Use area-devexp instead. label Sep 19, 2022
@bwilkerson
Copy link
Member

@scheglov

@scheglov
Copy link
Contributor

registerLintRules() from 'package:linter/src/rules.dart' should be called somewhere, e.g. in setUp().

@asashour
Copy link
Contributor Author

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

4 participants