Repository navigation
flutter analyze --flutter-repo should analyze analysis_options.yaml #127989
Description
Activity
- addedtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
on May 31, 2023 While looking at this I noticed that the Flutter tool actually jumps through some extra hoops to only analyze the
dev,examples, andpackagesdirectory:flutter/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
Lines 312 to 318 in 19719e3
List<String> getRepoRoots() { final String root = globals.fs.path.absolute(Cache.flutterRoot!); // not bin, and not the root return <String>['dev', 'examples', 'packages'].map<String>((String item) { return globals.fs.path.join(root, item); }).toList(); } I wonder why we decided to do that? It seems like it would be easier to just run the analyze command on the root of the repository and use the
excludessection in theanalysis_options.yamlfile to exclude the only directory we don't want to analyze:bin. (We already use theexcludessection to exclude other parts of the repo from analysis.) This would also ensure that theanalysis_options.yamlfile itself at the root of the repo is analyzed.In theory, with this approach we could even deprecated the
--flutter-repospecial flag and just runflutter analyze .in the root of the repository everywhere (e.g. on CI)...cc @Hixie This should explains why the deprecation notices you saw locally are not breaking our CI. It doesn't explain why you saw those notices locally in the first place, though...
- added a commit that references this issue
on Jun 2, 2023 The fix landed for this issue runs the analyzer on all subdirectories of the flutter checkout, and that can include user-created directories that don't contain flutter source at all.
For example, to make a hermetic image for flutter, Golem puts the pub cache in a pub-cache directory, and sets the analysis server temp directory to .dartServer, both in the root directory of flutter. I see notes where other users put config directories here rather than in their home directory. Only files that are part of the flutter repo should be analyzed by this command.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Jun 21, 2023
flutter analyze --flutter-repocurrently does not analyze theanalysis_options.yamlat the root of the repository. This caused us to miss some warnings about deprecated lints in that file. The command should be updated to analyze that file as well since it is part of the repository and it may have issues reported by the analyzer.Steps to repro the failure to report deprecated lints in that file:
iterable_contains_unrelated_typeto the analysis_options.yaml at the root of the repository.flutter analyze analysis_options.yaml.flutter analyze --flutter-repoand observe that no deprecated lint is reported.Expected Output:
Actual Output: nothing reported.