Add many more global analyses. (#47875)

* Update packages.

* Add many more global analyses.

* Catch trailing spaces and trailing newlines in all text files.
  Before we were only checking newly added files, but that means we
  missed some.

* Port the trailing spaces logic to work on Windows too.

* Correct all the files with trailing spaces and newlines.

* Refactor some of the dev/bots logic into a utils.dart library.
  Notably, the "exit" and "print" shims for testing are now usable
  from test.dart, analyze.dart, and run_command.dart.

* Add an "exitWithError" function that prints the red lines and
  then exits. This is the preferred way to exit from test.dart,
  analyze.dart, and run_command.dart.

* More consistency in the output of analyze.dart.

* Refactor analyze.dart to use the _allFiles file enumerating logic
  more widely.

* Add some double-checking logic to the _allFiles logic to catch
  cases where changes to that logic end up catching fewer files
  than expected (helps prevent future false positives).

* Add a check to prevent new binary files from being added to
  the repository. Grandfather in the binaries that we've already
  added.

* Update all the dependencies (needed because we now import crypto in
  dev/bots/analyze.dart).
This commit is contained in:
Ian Hickson
2019-12-30 17:12:19 -08:00
committed by GitHub
parent 4fbef2a4a9
commit e768c92fbc
85 changed files with 994 additions and 513 deletions

View File

@@ -191,5 +191,3 @@ Set<String> readDepfile(String depfilePath) {
.where((String path) => path.isNotEmpty)
.toSet();
}

View File

@@ -290,4 +290,3 @@ const Target androidx64ProfileBundle = AndroidAotBundle(androidx64Profile);
const Target androidArmReleaseBundle = AndroidAotBundle(androidArmRelease);
const Target androidArm64ReleaseBundle = AndroidAotBundle(androidArm64Release);
const Target androidx64ReleaseBundle = AndroidAotBundle(androidx64Release);

View File

@@ -275,11 +275,12 @@ class UpdatePackagesCommand extends FlutterCommand {
// here.
for (PubspecYaml pubspec in pubspecs) {
final String package = pubspec.name;
final String version = pubspec.version;
specialDependencies.add(package);
tree._versions[package] = pubspec.version;
assert(!tree._dependencyTree.containsKey(package));
tree._dependencyTree[package] = <String>{};
for (PubspecDependency dependency in pubspec.dependencies) {
if (dependency.kind == DependencyKind.normal) {
tree._versions[package] = version;
tree._dependencyTree[package] ??= <String>{};
tree._dependencyTree[package].add(dependency.name);
}
}
@@ -765,12 +766,16 @@ class PubspecYaml {
final List<String> transitiveDependenciesAsList = transitiveDependencies.toList()..sort();
final List<String> transitiveDevDependenciesAsList = transitiveDevDependencies.toList()..sort();
String computeTransitiveDependencyLineFor(String package) {
return ' $package: ${versions.versionFor(package)} $kTransitiveMagicString';
}
// Add a line for each transitive dependency and transitive dev dependency using our magic string to recognize them later.
for (String package in transitiveDependenciesAsList) {
transitiveDependencyOutput.add(' $package: ${versions.versionFor(package)} $kTransitiveMagicString');
transitiveDependencyOutput.add(computeTransitiveDependencyLineFor(package));
}
for (String package in transitiveDevDependenciesAsList) {
transitiveDevDependencyOutput.add(' $package: ${versions.versionFor(package)} $kTransitiveMagicString');
transitiveDevDependencyOutput.add(computeTransitiveDependencyLineFor(package));
}
// Build a sorted list of all dependencies for the checksum.
@@ -1239,7 +1244,7 @@ class PubDependencyTree {
}
/// The transitive closure of all the dependencies for the given package,
/// excluding any listen in `seen`.
/// excluding any listed in `seen`.
Iterable<String> getTransitiveDependenciesFor(
String package, {
@required Set<String> seen,