@@ -144,23 +144,29 @@ class Driver implements CommandLineStarter {
144144
145145 if (options.perfReport != null ) {
146146 var json = makePerfReport (
147- startTime, currentTimeMillis, options, _analyzedFileCount, stats);
147+ startTime,
148+ currentTimeMillis,
149+ options,
150+ _analyzedFileCount,
151+ stats,
152+ );
148153 io.File (options.perfReport! ).writeAsStringSync (json);
149154 }
150155 }
151156
152157 /// Perform analysis according to the given [options] .
153158 Future <ErrorSeverity > _analyzeAll (CommandLineOptions options) async {
154159 if (! options.jsonFormat && ! options.machineFormat) {
155- var fileNames = options.sourceFiles.map ((String file) {
156- file = path.normalize (file);
157- if (file == '.' ) {
158- file = path.basename (path.current);
159- } else if (file == '..' ) {
160- file = path.basename (path.normalize (path.absolute (file)));
161- }
162- return file;
163- }).toList ();
160+ var fileNames =
161+ options.sourceFiles.map ((String file) {
162+ file = path.normalize (file);
163+ if (file == '.' ) {
164+ file = path.basename (path.current);
165+ } else if (file == '..' ) {
166+ file = path.basename (path.normalize (path.absolute (file)));
167+ }
168+ return file;
169+ }).toList ();
164170
165171 outSink.writeln ("Analyzing ${fileNames .join (', ' )}..." );
166172 }
@@ -179,7 +185,10 @@ class Driver implements CommandLineStarter {
179185 var filePath = error.source.fullName;
180186 var file = analysisDriver! .resourceProvider.getFile (filePath);
181187 return determineProcessedSeverity (
182- error, options, analysisDriver! .getAnalysisOptionsForFile (file));
188+ error,
189+ options,
190+ analysisDriver! .getAnalysisOptionsForFile (file),
191+ );
183192 };
184193
185194 // We currently print out to stderr to ensure that when in batch mode we
@@ -190,16 +199,28 @@ class Driver implements CommandLineStarter {
190199 // batch flag and source file" error message.
191200 ErrorFormatter formatter;
192201 if (options.jsonFormat) {
193- formatter = JsonErrorFormatter (outSink, options, stats,
194- severityProcessor: defaultSeverityProcessor);
202+ formatter = JsonErrorFormatter (
203+ outSink,
204+ options,
205+ stats,
206+ severityProcessor: defaultSeverityProcessor,
207+ );
195208 } else if (options.machineFormat) {
196209 // The older machine format emits to stderr (instead of stdout) for legacy
197210 // reasons.
198- formatter = MachineErrorFormatter (errorSink, options, stats,
199- severityProcessor: defaultSeverityProcessor);
211+ formatter = MachineErrorFormatter (
212+ errorSink,
213+ options,
214+ stats,
215+ severityProcessor: defaultSeverityProcessor,
216+ );
200217 } else {
201- formatter = HumanErrorFormatter (outSink, options, stats,
202- severityProcessor: defaultSeverityProcessor);
218+ formatter = HumanErrorFormatter (
219+ outSink,
220+ options,
221+ stats,
222+ severityProcessor: defaultSeverityProcessor,
223+ );
203224 }
204225
205226 var allResult = ErrorSeverity .NONE ;
@@ -275,11 +296,14 @@ class Driver implements CommandLineStarter {
275296 isPart: false ,
276297 errors: errors,
277298 analysisOptions: analysisOptions,
278- )
299+ ),
279300 ]);
280301 for (var error in errors) {
281- var severity =
282- determineProcessedSeverity (error, options, analysisOptions);
302+ var severity = determineProcessedSeverity (
303+ error,
304+ options,
305+ analysisOptions,
306+ );
283307 if (severity != null ) {
284308 allResult = allResult.max (severity);
285309 }
@@ -294,17 +318,23 @@ class Driver implements CommandLineStarter {
294318 var node = loadYamlNode (content, sourceUrl: file.toUri ());
295319
296320 if (node is YamlMap ) {
297- errors.addAll (validatePubspec (
298- contents: node,
299- source: FileSource (file),
300- provider: resourceProvider,
301- analysisOptions: analysisOptions,
302- ));
321+ errors.addAll (
322+ validatePubspec (
323+ contents: node,
324+ source: FileSource (file),
325+ provider: resourceProvider,
326+ analysisOptions: analysisOptions,
327+ ),
328+ );
303329 }
304330 if (errors.isNotEmpty) {
305331 for (var error in errors) {
306- var severity = determineProcessedSeverity (
307- error, options, analysisOptions)! ;
332+ var severity =
333+ determineProcessedSeverity (
334+ error,
335+ options,
336+ analysisOptions,
337+ )! ;
308338 allResult = allResult.max (severity);
309339 }
310340 var lineInfo = LineInfo .fromContent (content);
@@ -329,14 +359,17 @@ class Driver implements CommandLineStarter {
329359 } else if (file_paths.isAndroidManifestXml (pathContext, path)) {
330360 try {
331361 var file = resourceProvider.getFile (path);
332- var analysisOptions =
333- analysisDriver.getAnalysisOptionsForFile (file);
362+ var analysisOptions = analysisDriver.getAnalysisOptionsForFile (
363+ file,
364+ );
334365 var content = file.readAsStringSync ();
335366 var source = FileSource (file);
336367 var validator = ManifestValidator (source);
337368 var lineInfo = LineInfo .fromContent (content);
338369 var errors = validator.validate (
339- content, analysisOptions.chromeOsManifestChecks);
370+ content,
371+ analysisOptions.chromeOsManifestChecks,
372+ );
340373 await formatter.formatErrors ([
341374 ErrorsResultImpl (
342375 session: analysisDriver.currentSession,
@@ -409,8 +442,10 @@ class Driver implements CommandLineStarter {
409442 var directory = io.Directory (filePath);
410443 if (directory.existsSync ()) {
411444 var pathContext = resourceProvider.pathContext;
412- for (var entry
413- in directory.listSync (recursive: true , followLinks: false )) {
445+ for (var entry in directory.listSync (
446+ recursive: true ,
447+ followLinks: false ,
448+ )) {
414449 var relative = path.relative (entry.path, from: directory.path);
415450 if ((file_paths.isDart (pathContext, entry.path) ||
416451 file_paths.isAndroidManifestXml (pathContext, entry.path)) &&
@@ -431,13 +466,23 @@ class Driver implements CommandLineStarter {
431466
432467 /// Analyze a single source.
433468 Future <ErrorSeverity > _runAnalyzer (
434- FileState file, CommandLineOptions options, ErrorFormatter formatter) {
469+ FileState file,
470+ CommandLineOptions options,
471+ ErrorFormatter formatter,
472+ ) {
435473 var startTime = currentTimeMillis;
436474 final analysisDriver = this .analysisDriver! ;
437- var analysisOptions =
438- analysisDriver.getAnalysisOptionsForFile (file.resource);
475+ var analysisOptions = analysisDriver.getAnalysisOptionsForFile (
476+ file.resource,
477+ );
439478 var analyzer = AnalyzerImpl (
440- analysisOptions, analysisDriver, file, options, stats, startTime);
479+ analysisOptions,
480+ analysisDriver,
481+ file,
482+ options,
483+ stats,
484+ startTime,
485+ );
441486 return analyzer.analyze (formatter);
442487 }
443488
@@ -448,8 +493,10 @@ class Driver implements CommandLineStarter {
448493 var path = options.defaultAnalysisOptionsPath;
449494 if (path != null ) {
450495 if (! resourceProvider.getFile (path).exists) {
451- printAndFail ('Options file not found: $path ' ,
452- exitCode: ErrorSeverity .ERROR .ordinal);
496+ printAndFail (
497+ 'Options file not found: $path ' ,
498+ exitCode: ErrorSeverity .ERROR .ordinal,
499+ );
453500 }
454501 }
455502 }
@@ -460,7 +507,9 @@ class Driver implements CommandLineStarter {
460507
461508 /// Return whether the [newOptions] are equal to the [previous] .
462509 static bool _equalCommandLineOptions (
463- CommandLineOptions ? previous, CommandLineOptions newOptions) {
510+ CommandLineOptions ? previous,
511+ CommandLineOptions newOptions,
512+ ) {
464513 return previous != null &&
465514 newOptions.defaultPackagesPath == previous.defaultPackagesPath &&
466515 _equalMaps (newOptions.declaredVariables, previous.declaredVariables) &&
@@ -509,7 +558,7 @@ class _AnalysisContextProvider {
509558 DriverBasedAnalysisContext ? _analysisContext;
510559
511560 _AnalysisContextProvider (this ._resourceProvider)
512- : _fileContentCache = FileContentCache (_resourceProvider);
561+ : _fileContentCache = FileContentCache (_resourceProvider);
513562
514563 DriverBasedAnalysisContext ? get analysisContext {
515564 return _analysisContext;
@@ -531,11 +580,10 @@ class _AnalysisContextProvider {
531580
532581 // Exclude patterns are relative to the directory with the options file.
533582 return PathFilter (
534- contextRoot.root.path,
535- optionsFile.parent.path,
536- analysisContext!
537- .getAnalysisOptionsForFile (optionsFile)
538- .excludePatterns);
583+ contextRoot.root.path,
584+ optionsFile.parent.path,
585+ analysisContext! .getAnalysisOptionsForFile (optionsFile).excludePatterns,
586+ );
539587 }
540588
541589 void configureForPath (String path) {
0 commit comments