@@ -64,41 +64,6 @@ Future<void> analyzeWithRules(String flutterRootDirectory, List<AnalyzeRule> rul
6464 }
6565}
6666
67- Future <void > analyzeToolWithRules (String flutterRootDirectory, List <AnalyzeRule > rules) async {
68- final String libPath = path.canonicalize ('$flutterRootDirectory /packages/flutter_tools/lib' );
69- if (! Directory (libPath).existsSync ()) {
70- foundError (< String > ['Analyzer error: the specified $libPath does not exist.' ]);
71- }
72- final String testPath = path.canonicalize ('$flutterRootDirectory /packages/flutter_tools/test' );
73- final AnalysisContextCollection collection = AnalysisContextCollection (
74- includedPaths: < String > [libPath, testPath],
75- );
76-
77- final List <String > analyzerErrors = < String > [];
78- for (final AnalysisContext context in collection.contexts) {
79- final Iterable <String > analyzedFilePaths = context.contextRoot.analyzedFiles ();
80- final AnalysisSession session = context.currentSession;
81-
82- for (final String filePath in analyzedFilePaths) {
83- final SomeResolvedUnitResult unit = await session.getResolvedUnit (filePath);
84- if (unit is ResolvedUnitResult ) {
85- for (final AnalyzeRule rule in rules) {
86- rule.applyTo (unit);
87- }
88- } else {
89- analyzerErrors.add ('Analyzer error: file $unit could not be resolved. Expected "ResolvedUnitResult", got ${unit .runtimeType }.' );
90- }
91- }
92- }
93-
94- if (analyzerErrors.isNotEmpty) {
95- foundError (analyzerErrors);
96- }
97- for (final AnalyzeRule verifier in rules) {
98- verifier.reportViolations (flutterRootDirectory);
99- }
100- }
101-
10267/// An interface that defines a set of best practices, and collects information
10368/// about code that violates the best practices in a [ResolvedUnitResult] .
10469///
0 commit comments