@@ -31,7 +31,7 @@ static auto disable_lint_rules(sourcemeta::core::SchemaTransformer &bundle,
31
31
auto sourcemeta::jsonschema::cli::lint (
32
32
const std::span<const std::string> &arguments) -> int {
33
33
const auto options{parse_options (
34
- arguments, {" f" , " fix" , " json" , " j" , " k" , " keep-ordering" })};
34
+ arguments, {" f" , " fix" , " json" , " j" , " k" , " keep-ordering" , " h " , " http " })};
35
35
const bool output_json = options.contains (" json" ) || options.contains (" j" );
36
36
37
37
sourcemeta::core::SchemaTransformer bundle;
@@ -63,12 +63,10 @@ auto sourcemeta::jsonschema::cli::lint(
63
63
64
64
bool result{true };
65
65
auto errors_array = sourcemeta::core::JSON::make_array ();
66
- const auto dialect{default_dialect (options)};
66
+ const auto dialect{infer_default_dialect (options)};
67
67
68
68
if (options.contains (" f" ) || options.contains (" fix" )) {
69
- for (const auto &entry :
70
- for_each_json (options.at (" " ), parse_ignore (options),
71
- parse_extensions (options))) {
69
+ for (const auto &entry : for_each_json_or_yaml (options.at (" " ), options)) {
72
70
log_verbose (options) << " Linting: " << entry.first .string () << " \n " ;
73
71
if (entry.first .extension () == " .yaml" ||
74
72
entry.first .extension () == " .yml" ) {
@@ -78,10 +76,7 @@ auto sourcemeta::jsonschema::cli::lint(
78
76
79
77
auto copy = entry.second ;
80
78
bundle.apply (copy, sourcemeta::core::schema_official_walker,
81
- resolver (options,
82
- options.contains (" h" ) || options.contains (" http" ),
83
- dialect),
84
- dialect);
79
+ infer_resolver (options, dialect), dialect);
85
80
std::ofstream output{entry.first };
86
81
if (options.contains (" k" ) || options.contains (" keep-ordering" )) {
87
82
sourcemeta::core::prettify (copy, output);
@@ -92,13 +87,11 @@ auto sourcemeta::jsonschema::cli::lint(
92
87
output << " \n " ;
93
88
}
94
89
}
95
- for (const auto &entry : for_each_json (options.at (" " ), parse_ignore (options),
96
- parse_extensions (options))) {
90
+ for (const auto &entry : for_each_json_or_yaml (options.at (" " ), options)) {
97
91
log_verbose (options) << " Linting: " << entry.first .string () << " \n " ;
98
92
const bool subresult = bundle.check (
99
93
entry.second , sourcemeta::core::schema_official_walker,
100
- resolver (options, options.contains (" h" ) || options.contains (" http" ),
101
- dialect),
94
+ infer_resolver (options, dialect),
102
95
[&](const auto &pointer, const auto &name, const auto &message) {
103
96
if (output_json) {
104
97
auto error_obj = sourcemeta::core::JSON::make_object ();
0 commit comments