[flutter_tools] add custom tool analysis to analyze.dart, lint Future.catchError (#140122)
Ensure tool code does not use Future.catchError or Future.onError, because it is not statically safe: https://github.com/dart-lang/sdk/issues/51248. This was proposed upstream in dart-lang/linter in https://github.com/dart-lang/linter/issues/4071 and https://github.com/dart-lang/linter/pull/4068, but not accepted.
This commit is contained in:
committed by
GitHub
parent
2ea5ca0345
commit
2dd06d10c9
@@ -8,7 +8,10 @@ import 'dart:io' as system show exit;
|
||||
import 'dart:io' hide exit;
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:analyzer/dart/analysis/results.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
const Duration _quietTimeout = Duration(minutes: 10); // how long the output should be hidden between calls to printProgress before just being verbose
|
||||
|
||||
@@ -253,3 +256,7 @@ Future<bool> _isPortAvailable(int port) async {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String locationInFile(ResolvedUnitResult unit, AstNode node, String workingDirectory) {
|
||||
return '${path.relative(path.relative(unit.path, from: workingDirectory))}:${unit.lineInfo.getLocation(node.offset).lineNumber}';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user