Skip to content

Commit 5627e0d

Browse files
authored
Add info project validator status (#109169)
1 parent 0fa8f76 commit 5627e0d

4 files changed

Lines changed: 16 additions & 17 deletions

File tree

packages/flutter_tools/lib/src/commands/validate_project.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class ValidateProject {
7676
case StatusProjectValidator.error:
7777
icon = '[✗]';
7878
break;
79+
case StatusProjectValidator.info:
7980
case StatusProjectValidator.success:
8081
icon = '[✓]';
8182
break;

packages/flutter_tools/lib/src/project_validator.dart

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,22 @@ class PubDependenciesProjectValidator extends ProjectValidator {
153153
}
154154
}
155155

156+
final String value;
156157
if (dependencies.isNotEmpty) {
157158
final String verb = dependencies.length == 1 ? 'is' : 'are';
158-
result.add(
159-
ProjectValidatorResult(
160-
name: name,
161-
value: '${dependencies.join(', ')} $verb not hosted',
162-
status: StatusProjectValidator.warning,
163-
)
164-
);
159+
value = '${dependencies.join(', ')} $verb not hosted';
165160
} else {
166-
result.add(
167-
const ProjectValidatorResult(
168-
name: name,
169-
value: 'All pub dependencies are hosted on https://pub.dartlang.org',
170-
status: StatusProjectValidator.success,
171-
)
172-
);
161+
value = 'All pub dependencies are hosted on https://pub.dartlang.org';
173162
}
174163

164+
result.add(
165+
ProjectValidatorResult(
166+
name: name,
167+
value: value,
168+
status: StatusProjectValidator.info,
169+
)
170+
);
171+
175172
return result;
176173
}
177174

packages/flutter_tools/lib/src/project_validator_result.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ enum StatusProjectValidator {
77
warning,
88
success,
99
crash,
10+
info,
1011
}
1112

1213
class ProjectValidatorResult {

packages/flutter_tools/test/general.shard/pub_dependencies_project_validator_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void main() {
3535
const String expected = 'All pub dependencies are hosted on https://pub.dartlang.org';
3636
expect(result.length, 1);
3737
expect(result[0].value, expected);
38-
expect(result[0].status, StatusProjectValidator.success);
38+
expect(result[0].status, StatusProjectValidator.info);
3939
});
4040

4141
testWithoutContext('error when command dart pub deps fails', () async {
@@ -56,7 +56,7 @@ void main() {
5656
expect(result[0].status, StatusProjectValidator.error);
5757
});
5858

59-
testWithoutContext('warning on dependencies not hosted', () async {
59+
testWithoutContext('info on dependencies not hosted', () async {
6060
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
6161
const FakeCommand(
6262
command: <String>['dart', 'pub', 'deps', '--json'],
@@ -71,7 +71,7 @@ void main() {
7171
const String expected = 'dep1, dep2 are not hosted';
7272
expect(result.length, 1);
7373
expect(result[0].value, expected);
74-
expect(result[0].status, StatusProjectValidator.warning);
74+
expect(result[0].status, StatusProjectValidator.info);
7575
});
7676
});
7777
}

0 commit comments

Comments
 (0)