[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>
This commit is contained in:
Devon Carew
2023-03-24 01:10:09 +00:00
committed by Commit Queue
parent 0ac7c843ee
commit e6ee09e23b
11 changed files with 48 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
include: package:lints/core.yaml include: package:lints/recommended.yaml
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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 /// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions. /// communicate with js_helper functions.
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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 /// Contains the names of globals that are embedded into the output by the
/// compiler. /// compiler.
/// ///
+1 -1
View File
@@ -1 +1 @@
include: package:lints/core.yaml include: package:lints/recommended.yaml
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// ignore_for_file: constant_identifier_names
/// A 'Universe' object used by 'dart:_rti'. /// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse'; const RTI_UNIVERSE = 'typeUniverse';
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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. /// Constants and predicates used for encoding and decoding type recipes.
/// ///
/// This library is synchronized between the compiler and the runtime system. /// This library is synchronized between the compiler and the runtime system.
+30 -3
View File
@@ -8,7 +8,7 @@
import 'dart:io'; import 'dart:io';
void main(List<String> args) { void main(List<String> args) {
const indent = 24; const indent = 29;
var dirs = Directory('pkg').listSync().whereType<Directory>().toList(); var dirs = Directory('pkg').listSync().whereType<Directory>().toList();
dirs.sort((a, b) => a.path.compareTo(b.path)); dirs.sort((a, b) => a.path.compareTo(b.path));
@@ -17,6 +17,8 @@ void main(List<String> args) {
var pubspec = File('${dir.path}/pubspec.yaml'); var pubspec = File('${dir.path}/pubspec.yaml');
if (!pubspec.existsSync()) continue; 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 options = File('${dir.path}/analysis_options.yaml');
var name = dir.path.split('/').last; var name = dir.path.split('/').last;
@@ -28,9 +30,34 @@ void main(List<String> args) {
} else if (optionsContent.contains('package:lints/recommended.yaml')) { } else if (optionsContent.contains('package:lints/recommended.yaml')) {
type = 'recommended'; type = 'recommended';
} }
print('${name.padRight(indent)}: $type'); print('${name.padRight(indent)}: ${type.padRight(12)} $slocDesc');
} else { } 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;
}
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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 /// Contains error codes that transformed async/async* functions use to
/// communicate with js_helper functions. /// communicate with js_helper functions.
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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 /// Contains the names of globals that are embedded into the output by the
/// compiler. /// compiler.
/// ///
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // BSD-style license that can be found in the LICENSE file.
// ignore_for_file: constant_identifier_names
/// A 'Universe' object used by 'dart:_rti'. /// A 'Universe' object used by 'dart:_rti'.
const RTI_UNIVERSE = 'typeUniverse'; const RTI_UNIVERSE = 'typeUniverse';
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // 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. // 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. /// Constants and predicates used for encoding and decoding type recipes.
/// ///
/// This library is synchronized between the compiler and the runtime system. /// This library is synchronized between the compiler and the runtime system.