[pkg/js_*] use package:lints/recommended.yaml for analysis for pkg/js_shared and pkg/js_runtime
Update the pkg/pkg.dart script to also include information about the size of the pkg/ packages (so we know ~how much code is on older analysis options sets).
Change-Id: Ief1b9a868752a01aef5dd95a4ce1c74795315bc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290615
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
diff --git a/pkg/js_runtime/analysis_options.yaml b/pkg/js_runtime/analysis_options.yaml
index c36c2c5..572dd23 100644
--- a/pkg/js_runtime/analysis_options.yaml
+++ b/pkg/js_runtime/analysis_options.yaml
@@ -1 +1 @@
-include: package:lints/core.yaml
+include: package:lints/recommended.yaml
diff --git a/pkg/js_runtime/lib/synced/async_await_error_codes.dart b/pkg/js_runtime/lib/synced/async_await_error_codes.dart
index f87406b..f76f3de 100644
--- a/pkg/js_runtime/lib/synced/async_await_error_codes.dart
+++ b/pkg/js_runtime/lib/synced/async_await_error_codes.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names
+
/// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions.
diff --git a/pkg/js_runtime/lib/synced/embedded_names.dart b/pkg/js_runtime/lib/synced/embedded_names.dart
index 66701f30..517c0d3 100644
--- a/pkg/js_runtime/lib/synced/embedded_names.dart
+++ b/pkg/js_runtime/lib/synced/embedded_names.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names, library_names
+
/// Contains the names of globals that are embedded into the output by the
/// compiler.
///
diff --git a/pkg/js_shared/analysis_options.yaml b/pkg/js_shared/analysis_options.yaml
index c36c2c5..572dd23 100644
--- a/pkg/js_shared/analysis_options.yaml
+++ b/pkg/js_shared/analysis_options.yaml
@@ -1 +1 @@
-include: package:lints/core.yaml
+include: package:lints/recommended.yaml
diff --git a/pkg/js_shared/lib/synced/embedded_names.dart b/pkg/js_shared/lib/synced/embedded_names.dart
index 415356c..90656ed 100644
--- a/pkg/js_shared/lib/synced/embedded_names.dart
+++ b/pkg/js_shared/lib/synced/embedded_names.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names
+
/// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse';
diff --git a/pkg/js_shared/lib/synced/recipe_syntax.dart b/pkg/js_shared/lib/synced/recipe_syntax.dart
index b761b31..ed1aadd 100644
--- a/pkg/js_shared/lib/synced/recipe_syntax.dart
+++ b/pkg/js_shared/lib/synced/recipe_syntax.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: library_names
+
/// Constants and predicates used for encoding and decoding type recipes.
///
/// This library is synchronized between the compiler and the runtime system.
diff --git a/pkg/pkg.dart b/pkg/pkg.dart
index 096246e..0cc17e6 100644
--- a/pkg/pkg.dart
+++ b/pkg/pkg.dart
@@ -8,7 +8,7 @@
import 'dart:io';
void main(List<String> args) {
- const indent = 24;
+ const indent = 29;
var dirs = Directory('pkg').listSync().whereType<Directory>().toList();
dirs.sort((a, b) => a.path.compareTo(b.path));
@@ -17,6 +17,8 @@
var pubspec = File('${dir.path}/pubspec.yaml');
if (!pubspec.existsSync()) continue;
+ var sloc = _calcLines(dir) / 1024.0;
+ var slocDesc = '(${sloc.toStringAsFixed(1).padLeft(6)}k lines)';
var options = File('${dir.path}/analysis_options.yaml');
var name = dir.path.split('/').last;
@@ -28,9 +30,34 @@
} else if (optionsContent.contains('package:lints/recommended.yaml')) {
type = 'recommended';
}
- print('${name.padRight(indent)}: $type');
+ print('${name.padRight(indent)}: ${type.padRight(12)} $slocDesc');
} else {
- print('${name.padRight(indent)}: default');
+ print('${name.padRight(indent)}: default $slocDesc');
}
}
}
+
+int _calcLines(Directory dir) {
+ var result = 0;
+
+ for (var entity in dir.listSync()) {
+ if (entity.name.startsWith('.')) continue;
+
+ if (entity is Directory) {
+ result += _calcLines(entity);
+ } else {
+ if (entity is File && entity.name.endsWith('.dart')) {
+ result += entity
+ .readAsLinesSync()
+ .where((line) => line.trim().isNotEmpty)
+ .length;
+ }
+ }
+ }
+
+ return result;
+}
+
+extension FileSystemEntityExtension on FileSystemEntity {
+ String get name => path.split('/').last;
+}
diff --git a/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart b/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
index f87406b..f76f3de 100644
--- a/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
+++ b/sdk/lib/_internal/js_runtime/lib/synced/async_await_error_codes.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names
+
/// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions.
diff --git a/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart b/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
index 66701f30..517c0d3 100644
--- a/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
+++ b/sdk/lib/_internal/js_runtime/lib/synced/embedded_names.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names, library_names
+
/// Contains the names of globals that are embedded into the output by the
/// compiler.
///
diff --git a/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart b/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
index 415356c..90656ed 100644
--- a/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
+++ b/sdk/lib/_internal/js_shared/lib/synced/embedded_names.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: constant_identifier_names
+
/// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse';
diff --git a/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart b/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
index b761b31..ed1aadd 100644
--- a/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
+++ b/sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: library_names
+
/// Constants and predicates used for encoding and decoding type recipes.
///
/// This library is synchronized between the compiler and the runtime system.