Skip to content

Commit 0f261f4

Browse files
committed
attempt to fix CI formatting
1 parent ff6665a commit 0f261f4

File tree

7 files changed

+205
-203
lines changed

7 files changed

+205
-203
lines changed

bin/dependency_validator.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,19 @@ example:
3636
usage:''';
3737

3838
/// Parses the command-line arguments
39-
final ArgParser argParser =
40-
ArgParser()
41-
..addFlag(helpArg, abbr: 'h', help: 'Displays this info.')
42-
..addFlag(
43-
verboseArg,
44-
defaultsTo: false,
45-
help: 'Display extra information for debugging.',
46-
)
47-
..addOption(
48-
rootDirArg,
49-
abbr: "C",
50-
help: 'Validate dependencies in a subdirectory',
51-
defaultsTo: '.',
52-
);
39+
final ArgParser argParser = ArgParser()
40+
..addFlag(helpArg, abbr: 'h', help: 'Displays this info.')
41+
..addFlag(
42+
verboseArg,
43+
defaultsTo: false,
44+
help: 'Display extra information for debugging.',
45+
)
46+
..addOption(
47+
rootDirArg,
48+
abbr: "C",
49+
help: 'Validate dependencies in a subdirectory',
50+
defaultsTo: '.',
51+
);
5352

5453
void showHelpAndExit({ExitCode exitCode = ExitCode.success}) {
5554
Logger.root.shout(helpMessage);

lib/src/constants.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class DependencyPinEvaluation {
5353
/// possible prerelease.
5454
static const DependencyPinEvaluation buildOrPrerelease =
5555
DependencyPinEvaluation._(
56-
'Builds or preleases as max bounds block minor bumps and patches.',
57-
);
56+
'Builds or preleases as max bounds block minor bumps and patches.',
57+
);
5858

5959
/// 1.2.3
6060
static const DependencyPinEvaluation directPin = DependencyPinEvaluation._(

lib/src/dependency_validator.dart

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,17 @@ Future<bool> checkPackage({required String root}) async {
5454
config = pubspecConfig.dependencyValidator;
5555
}
5656

57-
final excludes =
58-
config.exclude
59-
.map((s) {
60-
try {
61-
return makeGlob("$root/$s");
62-
} catch (_, __) {
63-
logger.shout(yellow.wrap('invalid glob syntax: "$s"'));
64-
return null;
65-
}
66-
})
67-
.nonNulls
68-
.toList();
57+
final excludes = config.exclude
58+
.map((s) {
59+
try {
60+
return makeGlob("$root/$s");
61+
} catch (_, __) {
62+
logger.shout(yellow.wrap('invalid glob syntax: "$s"'));
63+
return null;
64+
}
65+
})
66+
.nonNulls
67+
.toList();
6968
logger.fine('excludes:\n${bulletItems(excludes.map((g) => g.pattern))}\n');
7069
final ignoredPackages = config.ignore;
7170
logger.fine('ignored packages:\n${bulletItems(ignoredPackages)}\n');
@@ -268,13 +267,13 @@ Future<bool> checkPackage({required String root}) async {
268267
// Packages that are not used in lib/, but are used elsewhere, that are
269268
// dependencies when they should be dev_dependencies.
270269
final overPromotedDependencies =
271-
// Start with dependencies that are not used in lib/
272-
(deps
273-
.difference(packagesUsedInPublicFiles)
274-
// Intersect with deps that are used outside lib/ (excludes unused deps)
275-
.intersection(packagesUsedOutsidePublicDirs))
276-
// Ignore known over-promoted packages.
277-
..removeAll(ignoredPackages);
270+
// Start with dependencies that are not used in lib/
271+
(deps
272+
.difference(packagesUsedInPublicFiles)
273+
// Intersect with deps that are used outside lib/ (excludes unused deps)
274+
.intersection(packagesUsedOutsidePublicDirs))
275+
// Ignore known over-promoted packages.
276+
..removeAll(ignoredPackages);
278277

279278
if (overPromotedDependencies.isNotEmpty) {
280279
log(
@@ -287,10 +286,10 @@ Future<bool> checkPackage({required String root}) async {
287286

288287
// Packages that are used in lib/, but are dev_dependencies.
289288
final underPromotedDependencies =
290-
// Start with dev_dependencies that are used in lib/
291-
devDeps.intersection(packagesUsedInPublicFiles)
292-
// Ignore known under-promoted packages
293-
..removeAll(ignoredPackages);
289+
// Start with dev_dependencies that are used in lib/
290+
devDeps.intersection(packagesUsedInPublicFiles)
291+
// Ignore known under-promoted packages
292+
..removeAll(ignoredPackages);
294293

295294
if (underPromotedDependencies.isNotEmpty) {
296295
log(
@@ -334,8 +333,8 @@ Future<bool> checkPackage({required String root}) async {
334333
for (final target in rootBuildConfig.buildTargets.values)
335334
...target.builders.keys,
336335
]
337-
.map((key) => normalizeBuilderKeyUsage(key, pubspec.name))
338-
.any((key) => key.startsWith('$dependencyName:'));
336+
.map((key) => normalizeBuilderKeyUsage(key, pubspec.name))
337+
.any((key) => key.startsWith('$dependencyName:'));
339338

340339
final packagesWithConsumedBuilders = Set<String>();
341340
for (final name in unusedDependencies) {
@@ -420,7 +419,10 @@ Future<bool> checkPackage({required String root}) async {
420419
Future<bool> dependencyDefinesAutoAppliedBuilder(String path) async =>
421420
(await BuildConfig.fromPackageDir(
422421
path,
423-
)).builderDefinitions.values.any((def) => def.autoApply != AutoApply.none);
422+
))
423+
.builderDefinitions
424+
.values
425+
.any((def) => def.autoApply != AutoApply.none);
424426

425427
/// Checks for dependency pins.
426428
///

lib/src/pubspec_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PubspecDepValidatorConfig {
1717
dependencyValidator.ignore.isNotEmpty;
1818

1919
PubspecDepValidatorConfig({DepValidatorConfig? dependencyValidator})
20-
: dependencyValidator = dependencyValidator ?? DepValidatorConfig();
20+
: dependencyValidator = dependencyValidator ?? DepValidatorConfig();
2121

2222
factory PubspecDepValidatorConfig.fromJson(Map json) =>
2323
_$PubspecDepValidatorConfigFromJson(json);

test/pubspec_to_json.dart

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,45 @@ typedef Json = Map<String, dynamic>;
1212

1313
extension on Dependency {
1414
Json toJson() => switch (this) {
15-
SdkDependency(:final sdk, :final version) => {
16-
"sdk": sdk,
17-
"version": version.toString(),
18-
},
19-
HostedDependency(:final hosted, :final version) => {
20-
if (hosted != null) "hosted": hosted.url.toString(),
21-
"version": version.toString(),
22-
},
23-
GitDependency(:final url, :final ref, :final path) => {
24-
"git": {
25-
"url": url.toString(),
26-
if (path != null) "ref": ref,
27-
if (path != null) "path": path,
28-
},
29-
},
30-
PathDependency(:final path) => {"path": path.replaceAll(r'\', '/')},
31-
};
15+
SdkDependency(:final sdk, :final version) => {
16+
"sdk": sdk,
17+
"version": version.toString(),
18+
},
19+
HostedDependency(:final hosted, :final version) => {
20+
if (hosted != null) "hosted": hosted.url.toString(),
21+
"version": version.toString(),
22+
},
23+
GitDependency(:final url, :final ref, :final path) => {
24+
"git": {
25+
"url": url.toString(),
26+
if (path != null) "ref": ref,
27+
if (path != null) "path": path,
28+
},
29+
},
30+
PathDependency(:final path) => {"path": path.replaceAll(r'\', '/')},
31+
};
3232
}
3333

3434
/// An as-needed implementation of `Pubspec.toJson` for testing.
3535
///
3636
/// See: https://github.com/dart-lang/tools/issues/1801
3737
extension PubspecToJson on Pubspec {
3838
Json toJson() => {
39-
"name": name,
40-
"environment": {
41-
for (final (sdk, version) in environment.records) sdk: version.toString(),
42-
},
43-
if (resolution != null) "resolution": resolution,
44-
if (workspace != null) "workspace": workspace,
45-
"dependencies": {
46-
for (final (name, dependency) in dependencies.records)
47-
name: dependency.toJson(),
48-
},
49-
"dev_dependencies": {
50-
for (final (name, dependency) in devDependencies.records)
51-
name: dependency.toJson(),
52-
},
53-
// ...
54-
};
39+
"name": name,
40+
"environment": {
41+
for (final (sdk, version) in environment.records)
42+
sdk: version.toString(),
43+
},
44+
if (resolution != null) "resolution": resolution,
45+
if (workspace != null) "workspace": workspace,
46+
"dependencies": {
47+
for (final (name, dependency) in dependencies.records)
48+
name: dependency.toJson(),
49+
},
50+
"dev_dependencies": {
51+
for (final (name, dependency) in devDependencies.records)
52+
name: dependency.toJson(),
53+
},
54+
// ...
55+
};
5556
}

test/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Future<ProcessResult> checkProject({
4747
}
4848

4949
Dependency hostedCompatibleWith(String version) => HostedDependency(
50-
version: VersionConstraint.compatibleWith(Version.parse(version)),
51-
);
50+
version: VersionConstraint.compatibleWith(Version.parse(version)),
51+
);
5252

5353
Dependency hostedPinned(String version) =>
5454
HostedDependency(version: Version.parse(version));

0 commit comments

Comments
 (0)