Add info project validator status (#109169)
This commit is contained in:
parent
0fa8f765e4
commit
5627e0d1f6
@ -76,6 +76,7 @@ class ValidateProject {
|
|||||||
case StatusProjectValidator.error:
|
case StatusProjectValidator.error:
|
||||||
icon = '[✗]';
|
icon = '[✗]';
|
||||||
break;
|
break;
|
||||||
|
case StatusProjectValidator.info:
|
||||||
case StatusProjectValidator.success:
|
case StatusProjectValidator.success:
|
||||||
icon = '[✓]';
|
icon = '[✓]';
|
||||||
break;
|
break;
|
||||||
|
@ -153,25 +153,22 @@ class PubDependenciesProjectValidator extends ProjectValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String value;
|
||||||
if (dependencies.isNotEmpty) {
|
if (dependencies.isNotEmpty) {
|
||||||
final String verb = dependencies.length == 1 ? 'is' : 'are';
|
final String verb = dependencies.length == 1 ? 'is' : 'are';
|
||||||
result.add(
|
value = '${dependencies.join(', ')} $verb not hosted';
|
||||||
ProjectValidatorResult(
|
|
||||||
name: name,
|
|
||||||
value: '${dependencies.join(', ')} $verb not hosted',
|
|
||||||
status: StatusProjectValidator.warning,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
result.add(
|
value = 'All pub dependencies are hosted on https://pub.dartlang.org';
|
||||||
const ProjectValidatorResult(
|
|
||||||
name: name,
|
|
||||||
value: 'All pub dependencies are hosted on https://pub.dartlang.org',
|
|
||||||
status: StatusProjectValidator.success,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.add(
|
||||||
|
ProjectValidatorResult(
|
||||||
|
name: name,
|
||||||
|
value: value,
|
||||||
|
status: StatusProjectValidator.info,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ enum StatusProjectValidator {
|
|||||||
warning,
|
warning,
|
||||||
success,
|
success,
|
||||||
crash,
|
crash,
|
||||||
|
info,
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProjectValidatorResult {
|
class ProjectValidatorResult {
|
||||||
|
@ -35,7 +35,7 @@ void main() {
|
|||||||
const String expected = 'All pub dependencies are hosted on https://pub.dartlang.org';
|
const String expected = 'All pub dependencies are hosted on https://pub.dartlang.org';
|
||||||
expect(result.length, 1);
|
expect(result.length, 1);
|
||||||
expect(result[0].value, expected);
|
expect(result[0].value, expected);
|
||||||
expect(result[0].status, StatusProjectValidator.success);
|
expect(result[0].status, StatusProjectValidator.info);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('error when command dart pub deps fails', () async {
|
testWithoutContext('error when command dart pub deps fails', () async {
|
||||||
@ -56,7 +56,7 @@ void main() {
|
|||||||
expect(result[0].status, StatusProjectValidator.error);
|
expect(result[0].status, StatusProjectValidator.error);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('warning on dependencies not hosted', () async {
|
testWithoutContext('info on dependencies not hosted', () async {
|
||||||
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
command: <String>['dart', 'pub', 'deps', '--json'],
|
command: <String>['dart', 'pub', 'deps', '--json'],
|
||||||
@ -71,7 +71,7 @@ void main() {
|
|||||||
const String expected = 'dep1, dep2 are not hosted';
|
const String expected = 'dep1, dep2 are not hosted';
|
||||||
expect(result.length, 1);
|
expect(result.length, 1);
|
||||||
expect(result[0].value, expected);
|
expect(result[0].value, expected);
|
||||||
expect(result[0].status, StatusProjectValidator.warning);
|
expect(result[0].status, StatusProjectValidator.info);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user