Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject invalid onlyIssues CLI usage #239

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/cmd_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ValidationOptions _getValidationOptionsFromYaml(String fileName) {
const kOverride = 'override';

void abort(Object e) {
stderr.write(e);
stderr.writeln(e);
exit(kErrorCode);
}

Expand Down Expand Up @@ -135,7 +135,7 @@ ValidationOptions _getValidationOptionsFromYaml(String fileName) {
}
}, growable: false);
} else if (yamlIgnoredIssues != null) {
abort("$kYamlError 'ignored' must be a sequence.");
abort("$kYamlError '$kIgnore' must be a sequence.");
}

final Object yamlOnlyIssues = yaml[kOnly];
Expand All @@ -150,7 +150,12 @@ ValidationOptions _getValidationOptionsFromYaml(String fileName) {
}
}, growable: false);
} else if (yamlOnlyIssues != null) {
abort("$kYamlError 'only' must be a sequence.");
abort("$kYamlError '$kOnly' must be a sequence.");
}

if (onlyIssues != null && ignoredIssues != null) {
abort("$kYamlError option '$kOnly' cannot be used "
"along with option '$kIgnore'.");
}

final Object yamlSeveritiesMap = yaml[kOverride];
Expand Down
4 changes: 2 additions & 2 deletions node/gltf_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ Context _getContextFromOptions(_JSValidationOptions options) {
}

if (options.onlyIssues != null && options.ignoredIssues != null) {
throw ArgumentError(
'options.onlyIssues cannot be used along with options.ignoredIssues.');
throw ArgumentError('options.onlyIssues cannot be used '
'along with options.ignoredIssues.');
}

if (options.onlyIssues != null) {
Expand Down
Loading