@owenlamont/ryl 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +1 -0
- package/.github/dependabot.yml +13 -0
- package/.github/workflows/ci.yml +107 -0
- package/.github/workflows/release.yml +613 -0
- package/.github/workflows/update_dependencies.yml +61 -0
- package/.github/workflows/update_linters.yml +56 -0
- package/.pre-commit-config.yaml +87 -0
- package/.yamllint +4 -0
- package/AGENTS.md +200 -0
- package/Cargo.lock +908 -0
- package/Cargo.toml +32 -0
- package/LICENSE +21 -0
- package/README.md +230 -0
- package/bin/ryl.js +1 -0
- package/clippy.toml +1 -0
- package/docs/config-presets.md +100 -0
- package/img/benchmark-5x5-5runs.svg +2176 -0
- package/package.json +28 -0
- package/pyproject.toml +42 -0
- package/ruff.toml +107 -0
- package/rumdl.toml +20 -0
- package/rust-toolchain.toml +3 -0
- package/rustfmt.toml +3 -0
- package/scripts/benchmark_perf_vs_yamllint.py +400 -0
- package/scripts/coverage-missing.ps1 +80 -0
- package/scripts/coverage-missing.sh +60 -0
- package/src/bin/discover_config_bin.rs +24 -0
- package/src/cli_support.rs +33 -0
- package/src/conf/mod.rs +85 -0
- package/src/config.rs +2099 -0
- package/src/decoder.rs +326 -0
- package/src/discover.rs +31 -0
- package/src/lib.rs +19 -0
- package/src/lint.rs +558 -0
- package/src/main.rs +535 -0
- package/src/migrate.rs +233 -0
- package/src/rules/anchors.rs +517 -0
- package/src/rules/braces.rs +77 -0
- package/src/rules/brackets.rs +77 -0
- package/src/rules/colons.rs +475 -0
- package/src/rules/commas.rs +372 -0
- package/src/rules/comments.rs +299 -0
- package/src/rules/comments_indentation.rs +243 -0
- package/src/rules/document_end.rs +175 -0
- package/src/rules/document_start.rs +84 -0
- package/src/rules/empty_lines.rs +152 -0
- package/src/rules/empty_values.rs +255 -0
- package/src/rules/float_values.rs +259 -0
- package/src/rules/flow_collection.rs +562 -0
- package/src/rules/hyphens.rs +104 -0
- package/src/rules/indentation.rs +803 -0
- package/src/rules/key_duplicates.rs +218 -0
- package/src/rules/key_ordering.rs +303 -0
- package/src/rules/line_length.rs +326 -0
- package/src/rules/mod.rs +25 -0
- package/src/rules/new_line_at_end_of_file.rs +23 -0
- package/src/rules/new_lines.rs +95 -0
- package/src/rules/octal_values.rs +121 -0
- package/src/rules/quoted_strings.rs +577 -0
- package/src/rules/span_utils.rs +37 -0
- package/src/rules/trailing_spaces.rs +65 -0
- package/src/rules/truthy.rs +420 -0
- package/tests/brackets_carriage_return.rs +114 -0
- package/tests/build_global_cfg_error.rs +23 -0
- package/tests/cli_anchors_rule.rs +143 -0
- package/tests/cli_braces_rule.rs +104 -0
- package/tests/cli_brackets_rule.rs +104 -0
- package/tests/cli_colons_rule.rs +65 -0
- package/tests/cli_commas_rule.rs +104 -0
- package/tests/cli_comments_indentation_rule.rs +61 -0
- package/tests/cli_comments_rule.rs +67 -0
- package/tests/cli_config_data_error.rs +30 -0
- package/tests/cli_config_flags.rs +66 -0
- package/tests/cli_config_migrate.rs +229 -0
- package/tests/cli_document_end_rule.rs +92 -0
- package/tests/cli_document_start_rule.rs +92 -0
- package/tests/cli_empty_lines_rule.rs +87 -0
- package/tests/cli_empty_values_rule.rs +68 -0
- package/tests/cli_env_config.rs +34 -0
- package/tests/cli_exit_and_errors.rs +41 -0
- package/tests/cli_file_encoding.rs +203 -0
- package/tests/cli_float_values_rule.rs +64 -0
- package/tests/cli_format_options.rs +316 -0
- package/tests/cli_global_cfg_relaxed.rs +20 -0
- package/tests/cli_hyphens_rule.rs +104 -0
- package/tests/cli_indentation_rule.rs +65 -0
- package/tests/cli_invalid_project_config.rs +39 -0
- package/tests/cli_key_duplicates_rule.rs +104 -0
- package/tests/cli_key_ordering_rule.rs +59 -0
- package/tests/cli_line_length_rule.rs +85 -0
- package/tests/cli_list_files.rs +29 -0
- package/tests/cli_new_line_rule.rs +141 -0
- package/tests/cli_new_lines_rule.rs +119 -0
- package/tests/cli_octal_values_rule.rs +60 -0
- package/tests/cli_quoted_strings_rule.rs +47 -0
- package/tests/cli_toml_config.rs +119 -0
- package/tests/cli_trailing_spaces_rule.rs +77 -0
- package/tests/cli_truthy_rule.rs +83 -0
- package/tests/cli_yaml_files_negation.rs +45 -0
- package/tests/colons_rule.rs +303 -0
- package/tests/common/compat.rs +114 -0
- package/tests/common/fake_env.rs +93 -0
- package/tests/common/mod.rs +1 -0
- package/tests/conf_builtin.rs +9 -0
- package/tests/config_anchors.rs +84 -0
- package/tests/config_braces.rs +121 -0
- package/tests/config_brackets.rs +127 -0
- package/tests/config_commas.rs +79 -0
- package/tests/config_comments.rs +65 -0
- package/tests/config_comments_indentation.rs +20 -0
- package/tests/config_deep_merge_nonstring_key.rs +24 -0
- package/tests/config_document_end.rs +54 -0
- package/tests/config_document_start.rs +55 -0
- package/tests/config_empty_lines.rs +48 -0
- package/tests/config_empty_values.rs +35 -0
- package/tests/config_env_errors.rs +23 -0
- package/tests/config_env_invalid_inline.rs +15 -0
- package/tests/config_env_missing.rs +63 -0
- package/tests/config_env_shim.rs +301 -0
- package/tests/config_explicit_file_parse_error.rs +55 -0
- package/tests/config_extended_features.rs +225 -0
- package/tests/config_extends_inline.rs +185 -0
- package/tests/config_extends_sequence.rs +18 -0
- package/tests/config_find_project_home_boundary.rs +54 -0
- package/tests/config_find_project_two_files_in_cwd.rs +47 -0
- package/tests/config_float_values.rs +34 -0
- package/tests/config_from_yaml_paths.rs +32 -0
- package/tests/config_hyphens.rs +51 -0
- package/tests/config_ignore_errors.rs +243 -0
- package/tests/config_ignore_overrides.rs +83 -0
- package/tests/config_indentation.rs +65 -0
- package/tests/config_invalid_globs.rs +16 -0
- package/tests/config_invalid_types.rs +19 -0
- package/tests/config_key_duplicates.rs +34 -0
- package/tests/config_key_ordering.rs +70 -0
- package/tests/config_line_length.rs +65 -0
- package/tests/config_locale.rs +111 -0
- package/tests/config_merge.rs +26 -0
- package/tests/config_new_lines.rs +89 -0
- package/tests/config_octal_values.rs +33 -0
- package/tests/config_quoted_strings.rs +195 -0
- package/tests/config_rule_level.rs +147 -0
- package/tests/config_rules_non_string_keys.rs +23 -0
- package/tests/config_scalar_overrides.rs +27 -0
- package/tests/config_to_toml.rs +110 -0
- package/tests/config_toml_coverage.rs +80 -0
- package/tests/config_toml_discovery.rs +304 -0
- package/tests/config_trailing_spaces.rs +152 -0
- package/tests/config_truthy.rs +77 -0
- package/tests/config_yaml_files.rs +62 -0
- package/tests/config_yaml_files_all_non_string.rs +15 -0
- package/tests/config_yaml_files_empty.rs +30 -0
- package/tests/coverage_commas.rs +46 -0
- package/tests/decoder_decode.rs +338 -0
- package/tests/discover_config_bin_all.rs +66 -0
- package/tests/discover_config_bin_env_invalid_yaml.rs +26 -0
- package/tests/discover_config_bin_project_config_parse_error.rs +24 -0
- package/tests/discover_config_bin_user_global_error.rs +26 -0
- package/tests/discover_module.rs +30 -0
- package/tests/discover_per_file_dir.rs +10 -0
- package/tests/discover_per_file_project_config_error.rs +21 -0
- package/tests/float_values.rs +43 -0
- package/tests/lint_multi_errors.rs +32 -0
- package/tests/main_yaml_ok_filtering.rs +30 -0
- package/tests/migrate_module.rs +259 -0
- package/tests/resolve_ctx_empty_parent.rs +16 -0
- package/tests/rule_anchors.rs +442 -0
- package/tests/rule_braces.rs +258 -0
- package/tests/rule_brackets.rs +217 -0
- package/tests/rule_commas.rs +205 -0
- package/tests/rule_comments.rs +197 -0
- package/tests/rule_comments_indentation.rs +127 -0
- package/tests/rule_document_end.rs +118 -0
- package/tests/rule_document_start.rs +60 -0
- package/tests/rule_empty_lines.rs +96 -0
- package/tests/rule_empty_values.rs +102 -0
- package/tests/rule_float_values.rs +109 -0
- package/tests/rule_hyphens.rs +65 -0
- package/tests/rule_indentation.rs +455 -0
- package/tests/rule_key_duplicates.rs +76 -0
- package/tests/rule_key_ordering.rs +207 -0
- package/tests/rule_line_length.rs +200 -0
- package/tests/rule_new_lines.rs +51 -0
- package/tests/rule_octal_values.rs +53 -0
- package/tests/rule_quoted_strings.rs +290 -0
- package/tests/rule_trailing_spaces.rs +41 -0
- package/tests/rule_truthy.rs +236 -0
- package/tests/user_global_invalid_yaml.rs +32 -0
- package/tests/yamllint_compat_anchors.rs +280 -0
- package/tests/yamllint_compat_braces.rs +411 -0
- package/tests/yamllint_compat_brackets.rs +364 -0
- package/tests/yamllint_compat_colons.rs +298 -0
- package/tests/yamllint_compat_colors.rs +80 -0
- package/tests/yamllint_compat_commas.rs +375 -0
- package/tests/yamllint_compat_comments.rs +167 -0
- package/tests/yamllint_compat_comments_indentation.rs +281 -0
- package/tests/yamllint_compat_config.rs +170 -0
- package/tests/yamllint_compat_document_end.rs +243 -0
- package/tests/yamllint_compat_document_start.rs +136 -0
- package/tests/yamllint_compat_empty_lines.rs +117 -0
- package/tests/yamllint_compat_empty_values.rs +179 -0
- package/tests/yamllint_compat_float_values.rs +216 -0
- package/tests/yamllint_compat_hyphens.rs +223 -0
- package/tests/yamllint_compat_indentation.rs +398 -0
- package/tests/yamllint_compat_key_duplicates.rs +139 -0
- package/tests/yamllint_compat_key_ordering.rs +170 -0
- package/tests/yamllint_compat_line_length.rs +375 -0
- package/tests/yamllint_compat_list.rs +127 -0
- package/tests/yamllint_compat_new_line.rs +133 -0
- package/tests/yamllint_compat_newline_types.rs +185 -0
- package/tests/yamllint_compat_octal_values.rs +172 -0
- package/tests/yamllint_compat_quoted_strings.rs +154 -0
- package/tests/yamllint_compat_syntax.rs +200 -0
- package/tests/yamllint_compat_trailing_spaces.rs +162 -0
- package/tests/yamllint_compat_truthy.rs +130 -0
- package/tests/yamllint_compat_yaml_files.rs +81 -0
- package/typos.toml +2 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
use std::path::{Path, PathBuf};
|
|
2
|
+
|
|
3
|
+
use ryl::config::{Overrides, discover_config_with, discover_per_file};
|
|
4
|
+
use tempfile::tempdir;
|
|
5
|
+
|
|
6
|
+
#[path = "common/mod.rs"]
|
|
7
|
+
mod common;
|
|
8
|
+
use common::fake_env::FakeEnv;
|
|
9
|
+
|
|
10
|
+
#[test]
|
|
11
|
+
fn project_toml_takes_precedence_over_yaml_and_adds_notice() {
|
|
12
|
+
let env = FakeEnv::new()
|
|
13
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
14
|
+
.with_file(
|
|
15
|
+
PathBuf::from("/repo/.ryl.toml"),
|
|
16
|
+
"locale = 'fr_FR.UTF-8'\n[rules]\nanchors = 'disable'\n",
|
|
17
|
+
)
|
|
18
|
+
.with_file(
|
|
19
|
+
PathBuf::from("/repo/.yamllint"),
|
|
20
|
+
"locale: en_US.UTF-8\nrules: {}\n",
|
|
21
|
+
)
|
|
22
|
+
.with_exists(PathBuf::from("/repo/file.yaml"));
|
|
23
|
+
let ctx = discover_config_with(
|
|
24
|
+
&[PathBuf::from("/repo/file.yaml")],
|
|
25
|
+
&Overrides::default(),
|
|
26
|
+
&env,
|
|
27
|
+
)
|
|
28
|
+
.expect("project TOML should load");
|
|
29
|
+
assert_eq!(ctx.source.as_deref(), Some(Path::new("/repo/.ryl.toml")));
|
|
30
|
+
assert_eq!(ctx.config.locale(), Some("fr_FR.UTF-8"));
|
|
31
|
+
assert_eq!(ctx.notices.len(), 1);
|
|
32
|
+
assert!(ctx.notices[0].contains("ignoring legacy YAML config discovery"));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[test]
|
|
36
|
+
fn explicit_pyproject_with_tool_ryl_section_loads() {
|
|
37
|
+
let pyproject = PathBuf::from("/repo/pyproject.toml");
|
|
38
|
+
let env = FakeEnv::new().with_cwd(PathBuf::from("/repo")).with_file(
|
|
39
|
+
pyproject.clone(),
|
|
40
|
+
"[project]\nname = 'demo'\nversion = '0.1.0'\n[tool.ryl]\nlocale = 'en_GB.UTF-8'\n",
|
|
41
|
+
);
|
|
42
|
+
let ctx = discover_config_with(
|
|
43
|
+
&[],
|
|
44
|
+
&Overrides {
|
|
45
|
+
config_file: Some(pyproject),
|
|
46
|
+
config_data: None,
|
|
47
|
+
},
|
|
48
|
+
&env,
|
|
49
|
+
)
|
|
50
|
+
.expect("explicit pyproject [tool.ryl] should load");
|
|
51
|
+
assert_eq!(ctx.config.locale(), Some("en_GB.UTF-8"));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#[test]
|
|
55
|
+
fn project_pyproject_without_tool_ryl_falls_back_to_yaml() {
|
|
56
|
+
let env = FakeEnv::new()
|
|
57
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
58
|
+
.with_file(
|
|
59
|
+
PathBuf::from("/repo/pyproject.toml"),
|
|
60
|
+
"[project]\nname = 'demo'\nversion = '0.1.0'\n",
|
|
61
|
+
)
|
|
62
|
+
.with_file(
|
|
63
|
+
PathBuf::from("/repo/.yamllint"),
|
|
64
|
+
"locale: en_US.UTF-8\nrules: {}\n",
|
|
65
|
+
)
|
|
66
|
+
.with_exists(PathBuf::from("/repo/file.yaml"));
|
|
67
|
+
let ctx = discover_config_with(
|
|
68
|
+
&[PathBuf::from("/repo/file.yaml")],
|
|
69
|
+
&Overrides::default(),
|
|
70
|
+
&env,
|
|
71
|
+
)
|
|
72
|
+
.expect("yaml fallback should load");
|
|
73
|
+
assert_eq!(ctx.source.as_deref(), Some(Path::new("/repo/.yamllint")));
|
|
74
|
+
assert_eq!(ctx.config.locale(), Some("en_US.UTF-8"));
|
|
75
|
+
assert!(ctx.notices.is_empty());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#[test]
|
|
79
|
+
fn discover_per_file_finds_project_toml() {
|
|
80
|
+
let td = tempdir().unwrap();
|
|
81
|
+
let root = td.path();
|
|
82
|
+
std::fs::write(root.join(".ryl.toml"), "[rules]\nanchors = 'disable'\n").unwrap();
|
|
83
|
+
std::fs::write(root.join("file.yaml"), "a: 1\n").unwrap();
|
|
84
|
+
let ctx = discover_per_file(&root.join("file.yaml")).expect("per-file discovery");
|
|
85
|
+
assert_eq!(
|
|
86
|
+
ctx.source.as_deref(),
|
|
87
|
+
Some(root.join(".ryl.toml").as_path())
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#[test]
|
|
92
|
+
fn project_skips_non_ryl_pyproject_and_uses_parent_toml() {
|
|
93
|
+
let env = FakeEnv::new()
|
|
94
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
95
|
+
.with_file(
|
|
96
|
+
PathBuf::from("/repo/sub/pyproject.toml"),
|
|
97
|
+
"[project]\nname = 'sub'\nversion = '0.1.0'\n",
|
|
98
|
+
)
|
|
99
|
+
.with_file(
|
|
100
|
+
PathBuf::from("/repo/.ryl.toml"),
|
|
101
|
+
"locale = 'fr_FR.UTF-8'\n[rules]\nanchors = 'disable'\n",
|
|
102
|
+
)
|
|
103
|
+
.with_exists(PathBuf::from("/repo/sub/file.yaml"));
|
|
104
|
+
let ctx = discover_config_with(
|
|
105
|
+
&[PathBuf::from("/repo/sub/file.yaml")],
|
|
106
|
+
&Overrides::default(),
|
|
107
|
+
&env,
|
|
108
|
+
)
|
|
109
|
+
.expect("ancestor TOML should load");
|
|
110
|
+
assert_eq!(ctx.source.as_deref(), Some(Path::new("/repo/.ryl.toml")));
|
|
111
|
+
assert_eq!(ctx.config.locale(), Some("fr_FR.UTF-8"));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#[test]
|
|
115
|
+
fn project_pyproject_with_tool_ryl_is_used() {
|
|
116
|
+
let env = FakeEnv::new()
|
|
117
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
118
|
+
.with_file(
|
|
119
|
+
PathBuf::from("/repo/pyproject.toml"),
|
|
120
|
+
"[project]\nname = 'demo'\nversion = '0.1.0'\n[tool.ryl]\nlocale = 'de_DE.UTF-8'\n",
|
|
121
|
+
)
|
|
122
|
+
.with_exists(PathBuf::from("/repo/file.yaml"));
|
|
123
|
+
let ctx = discover_config_with(
|
|
124
|
+
&[PathBuf::from("/repo/file.yaml")],
|
|
125
|
+
&Overrides::default(),
|
|
126
|
+
&env,
|
|
127
|
+
)
|
|
128
|
+
.expect("pyproject [tool.ryl] should load");
|
|
129
|
+
assert_eq!(
|
|
130
|
+
ctx.source.as_deref(),
|
|
131
|
+
Some(Path::new("/repo/pyproject.toml"))
|
|
132
|
+
);
|
|
133
|
+
assert_eq!(ctx.config.locale(), Some("de_DE.UTF-8"));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#[test]
|
|
137
|
+
fn explicit_pyproject_requires_tool_ryl_section() {
|
|
138
|
+
let pyproject = PathBuf::from("/repo/pyproject.toml");
|
|
139
|
+
let env = FakeEnv::new().with_cwd(PathBuf::from("/repo")).with_file(
|
|
140
|
+
pyproject.clone(),
|
|
141
|
+
"[project]\nname = 'demo'\nversion = '0.1.0'\n",
|
|
142
|
+
);
|
|
143
|
+
let err = discover_config_with(
|
|
144
|
+
&[],
|
|
145
|
+
&Overrides {
|
|
146
|
+
config_file: Some(pyproject),
|
|
147
|
+
config_data: None,
|
|
148
|
+
},
|
|
149
|
+
&env,
|
|
150
|
+
)
|
|
151
|
+
.unwrap_err();
|
|
152
|
+
assert!(err.contains("missing [tool.ryl] section"));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
#[test]
|
|
156
|
+
fn toml_config_rejects_extends_key() {
|
|
157
|
+
let cfg = PathBuf::from("/repo/.ryl.toml");
|
|
158
|
+
let env = FakeEnv::new()
|
|
159
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
160
|
+
.with_file(cfg.clone(), "extends = 'relaxed'\n");
|
|
161
|
+
let err = discover_config_with(
|
|
162
|
+
&[],
|
|
163
|
+
&Overrides {
|
|
164
|
+
config_file: Some(cfg),
|
|
165
|
+
config_data: None,
|
|
166
|
+
},
|
|
167
|
+
&env,
|
|
168
|
+
)
|
|
169
|
+
.unwrap_err();
|
|
170
|
+
assert!(err.contains("extends is not supported in TOML configuration"));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
#[test]
|
|
174
|
+
fn explicit_toml_parse_error_is_reported() {
|
|
175
|
+
let cfg = PathBuf::from("/repo/.ryl.toml");
|
|
176
|
+
let env = FakeEnv::new()
|
|
177
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
178
|
+
.with_file(cfg.clone(), "rules = [\n");
|
|
179
|
+
let err = discover_config_with(
|
|
180
|
+
&[],
|
|
181
|
+
&Overrides {
|
|
182
|
+
config_file: Some(cfg),
|
|
183
|
+
config_data: None,
|
|
184
|
+
},
|
|
185
|
+
&env,
|
|
186
|
+
)
|
|
187
|
+
.unwrap_err();
|
|
188
|
+
assert!(err.contains("failed to parse config data"));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#[test]
|
|
192
|
+
fn toml_scalar_types_are_accepted_for_unknown_keys() {
|
|
193
|
+
let cfg = PathBuf::from("/repo/.ryl.toml");
|
|
194
|
+
let env = FakeEnv::new().with_cwd(PathBuf::from("/repo")).with_file(
|
|
195
|
+
cfg.clone(),
|
|
196
|
+
"flag = true\nratio = 1.5\nstamp = 1979-05-27T07:32:00Z\n[rules]\nanchors = 'disable'\n",
|
|
197
|
+
);
|
|
198
|
+
discover_config_with(
|
|
199
|
+
&[],
|
|
200
|
+
&Overrides {
|
|
201
|
+
config_file: Some(cfg),
|
|
202
|
+
config_data: None,
|
|
203
|
+
},
|
|
204
|
+
&env,
|
|
205
|
+
)
|
|
206
|
+
.expect("scalar conversion should parse");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#[test]
|
|
210
|
+
fn toml_integer_scalar_is_accepted_for_unknown_keys() {
|
|
211
|
+
let cfg = PathBuf::from("/repo/.ryl.toml");
|
|
212
|
+
let env = FakeEnv::new()
|
|
213
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
214
|
+
.with_file(cfg.clone(), "answer = 42\n[rules]\nanchors = 'disable'\n");
|
|
215
|
+
discover_config_with(
|
|
216
|
+
&[],
|
|
217
|
+
&Overrides {
|
|
218
|
+
config_file: Some(cfg),
|
|
219
|
+
config_data: None,
|
|
220
|
+
},
|
|
221
|
+
&env,
|
|
222
|
+
)
|
|
223
|
+
.expect("integer conversion should parse");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
#[test]
|
|
227
|
+
fn toml_float_value_for_locale_reports_string_error() {
|
|
228
|
+
let cfg = PathBuf::from("/repo/.ryl.toml");
|
|
229
|
+
let env = FakeEnv::new()
|
|
230
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
231
|
+
.with_file(cfg.clone(), "locale = 1.25\n");
|
|
232
|
+
let err = discover_config_with(
|
|
233
|
+
&[],
|
|
234
|
+
&Overrides {
|
|
235
|
+
config_file: Some(cfg),
|
|
236
|
+
config_data: None,
|
|
237
|
+
},
|
|
238
|
+
&env,
|
|
239
|
+
)
|
|
240
|
+
.unwrap_err();
|
|
241
|
+
assert!(err.contains("invalid config: locale should be a string"));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#[test]
|
|
245
|
+
fn invalid_project_pyproject_toml_errors_in_discover_config() {
|
|
246
|
+
let env = FakeEnv::new()
|
|
247
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
248
|
+
.with_file(PathBuf::from("/repo/pyproject.toml"), "[tool.ryl\n")
|
|
249
|
+
.with_exists(PathBuf::from("/repo/file.yaml"));
|
|
250
|
+
let err = discover_config_with(
|
|
251
|
+
&[PathBuf::from("/repo/file.yaml")],
|
|
252
|
+
&Overrides::default(),
|
|
253
|
+
&env,
|
|
254
|
+
)
|
|
255
|
+
.unwrap_err();
|
|
256
|
+
assert!(err.contains("failed to parse config data"));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
#[test]
|
|
260
|
+
fn invalid_project_pyproject_toml_errors_in_discover_per_file() {
|
|
261
|
+
let td = tempdir().unwrap();
|
|
262
|
+
let root = td.path();
|
|
263
|
+
std::fs::write(root.join("pyproject.toml"), "[tool.ryl\n").unwrap();
|
|
264
|
+
std::fs::write(root.join("file.yaml"), "a: 1\n").unwrap();
|
|
265
|
+
let err = discover_per_file(&root.join("file.yaml")).unwrap_err();
|
|
266
|
+
assert!(err.contains("failed to parse config data"));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#[test]
|
|
270
|
+
fn explicit_invalid_pyproject_toml_reports_parse_error() {
|
|
271
|
+
let pyproject = PathBuf::from("/repo/pyproject.toml");
|
|
272
|
+
let env = FakeEnv::new()
|
|
273
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
274
|
+
.with_file(pyproject.clone(), "[tool.ryl\n");
|
|
275
|
+
let err = discover_config_with(
|
|
276
|
+
&[],
|
|
277
|
+
&Overrides {
|
|
278
|
+
config_file: Some(pyproject),
|
|
279
|
+
config_data: None,
|
|
280
|
+
},
|
|
281
|
+
&env,
|
|
282
|
+
)
|
|
283
|
+
.unwrap_err();
|
|
284
|
+
assert!(err.contains("failed to parse config data"));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
#[test]
|
|
288
|
+
fn yaml_extends_toml_is_rejected() {
|
|
289
|
+
let cfg = PathBuf::from("/repo/.yamllint");
|
|
290
|
+
let env = FakeEnv::new()
|
|
291
|
+
.with_cwd(PathBuf::from("/repo"))
|
|
292
|
+
.with_file(cfg.clone(), "extends: .ryl.toml\n")
|
|
293
|
+
.with_file(PathBuf::from("/repo/.ryl.toml"), "locale = 'en_US.UTF-8'\n");
|
|
294
|
+
let err = discover_config_with(
|
|
295
|
+
&[],
|
|
296
|
+
&Overrides {
|
|
297
|
+
config_file: Some(cfg),
|
|
298
|
+
config_data: None,
|
|
299
|
+
},
|
|
300
|
+
&env,
|
|
301
|
+
)
|
|
302
|
+
.unwrap_err();
|
|
303
|
+
assert!(err.contains("extends cannot reference TOML configuration"));
|
|
304
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
use std::fs;
|
|
2
|
+
|
|
3
|
+
use ryl::config::{Overrides, YamlLintConfig, discover_config};
|
|
4
|
+
use tempfile::tempdir;
|
|
5
|
+
|
|
6
|
+
#[test]
|
|
7
|
+
fn error_on_unknown_option() {
|
|
8
|
+
let err =
|
|
9
|
+
YamlLintConfig::from_yaml_str("rules:\n trailing-spaces:\n foo: true\n")
|
|
10
|
+
.unwrap_err();
|
|
11
|
+
assert_eq!(
|
|
12
|
+
err,
|
|
13
|
+
"invalid config: unknown option \"foo\" for rule \"trailing-spaces\""
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[test]
|
|
18
|
+
fn error_on_invalid_ignore_type() {
|
|
19
|
+
let err =
|
|
20
|
+
YamlLintConfig::from_yaml_str("rules:\n trailing-spaces:\n ignore: 1\n")
|
|
21
|
+
.unwrap_err();
|
|
22
|
+
assert_eq!(err, "invalid config: ignore should contain file patterns");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[test]
|
|
26
|
+
fn error_on_invalid_ignore_from_file_type() {
|
|
27
|
+
let err = YamlLintConfig::from_yaml_str(
|
|
28
|
+
"rules:\n trailing-spaces:\n ignore-from-file: 1\n",
|
|
29
|
+
)
|
|
30
|
+
.unwrap_err();
|
|
31
|
+
assert_eq!(
|
|
32
|
+
err,
|
|
33
|
+
"invalid config: ignore-from-file should contain filename(s), either as a list or string"
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[test]
|
|
38
|
+
fn error_on_invalid_rule_ignore_pattern() {
|
|
39
|
+
let cfg = "rules:\n trailing-spaces:\n ignore: ['[']\n";
|
|
40
|
+
let err = discover_config(
|
|
41
|
+
&[],
|
|
42
|
+
&Overrides {
|
|
43
|
+
config_file: None,
|
|
44
|
+
config_data: Some(cfg.into()),
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
.unwrap_err();
|
|
48
|
+
assert!(
|
|
49
|
+
err.contains("invalid config: ignore pattern '["),
|
|
50
|
+
"unexpected error message: {err}"
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#[test]
|
|
55
|
+
fn error_on_missing_rule_ignore_from_file() {
|
|
56
|
+
let cfg = "rules:\n trailing-spaces:\n ignore-from-file: missing.txt\n";
|
|
57
|
+
let err = discover_config(
|
|
58
|
+
&[],
|
|
59
|
+
&Overrides {
|
|
60
|
+
config_file: None,
|
|
61
|
+
config_data: Some(cfg.into()),
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
.unwrap_err();
|
|
65
|
+
assert!(
|
|
66
|
+
err.contains("failed to read ignore-from-file"),
|
|
67
|
+
"unexpected error message: {err}"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#[test]
|
|
72
|
+
fn error_on_invalid_rule_ignore_from_file_pattern() {
|
|
73
|
+
let dir = tempdir().unwrap();
|
|
74
|
+
let patterns = dir.path().join("patterns.txt");
|
|
75
|
+
fs::write(&patterns, "[\n").unwrap();
|
|
76
|
+
let config = dir.path().join("config.yml");
|
|
77
|
+
let config_body = format!(
|
|
78
|
+
"rules:\n trailing-spaces:\n ignore-from-file: '{}'\n",
|
|
79
|
+
patterns.display().to_string().replace('\'', "''")
|
|
80
|
+
);
|
|
81
|
+
fs::write(&config, config_body).unwrap();
|
|
82
|
+
|
|
83
|
+
let err = discover_config(
|
|
84
|
+
&[],
|
|
85
|
+
&Overrides {
|
|
86
|
+
config_file: Some(config),
|
|
87
|
+
config_data: None,
|
|
88
|
+
},
|
|
89
|
+
)
|
|
90
|
+
.unwrap_err();
|
|
91
|
+
assert!(
|
|
92
|
+
err.contains("invalid config: ignore-from-file pattern"),
|
|
93
|
+
"unexpected error message: {err}"
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#[test]
|
|
98
|
+
fn rule_ignore_from_file_skips_blank_lines() {
|
|
99
|
+
let dir = tempdir().unwrap();
|
|
100
|
+
let patterns = dir.path().join("patterns.txt");
|
|
101
|
+
fs::write(&patterns, "\nignored.yaml\n").unwrap();
|
|
102
|
+
let config = dir.path().join("config.yml");
|
|
103
|
+
let config_body = format!(
|
|
104
|
+
"rules:\n trailing-spaces:\n ignore-from-file: '{}'\n",
|
|
105
|
+
patterns.display().to_string().replace('\'', "''")
|
|
106
|
+
);
|
|
107
|
+
fs::write(&config, config_body).unwrap();
|
|
108
|
+
|
|
109
|
+
discover_config(
|
|
110
|
+
&[],
|
|
111
|
+
&Overrides {
|
|
112
|
+
config_file: Some(config),
|
|
113
|
+
config_data: None,
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
.expect("config with blank lines in ignore-from-file should parse");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
#[test]
|
|
120
|
+
fn rule_ignore_with_empty_list_produces_no_matcher() {
|
|
121
|
+
let cfg = "rules:\n trailing-spaces:\n ignore: []\n";
|
|
122
|
+
discover_config(
|
|
123
|
+
&[],
|
|
124
|
+
&Overrides {
|
|
125
|
+
config_file: None,
|
|
126
|
+
config_data: Some(cfg.into()),
|
|
127
|
+
},
|
|
128
|
+
)
|
|
129
|
+
.expect("empty ignore list should be accepted");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#[test]
|
|
133
|
+
fn rule_ignore_from_file_with_only_blank_lines_produces_no_matcher() {
|
|
134
|
+
let dir = tempdir().unwrap();
|
|
135
|
+
let patterns = dir.path().join("patterns.txt");
|
|
136
|
+
fs::write(&patterns, "\n\n").unwrap();
|
|
137
|
+
let config = dir.path().join("config.yml");
|
|
138
|
+
let config_body = format!(
|
|
139
|
+
"rules:\n trailing-spaces:\n ignore-from-file: '{}'\n",
|
|
140
|
+
patterns.display().to_string().replace('\'', "''")
|
|
141
|
+
);
|
|
142
|
+
fs::write(&config, config_body).unwrap();
|
|
143
|
+
|
|
144
|
+
discover_config(
|
|
145
|
+
&[],
|
|
146
|
+
&Overrides {
|
|
147
|
+
config_file: Some(config),
|
|
148
|
+
config_data: None,
|
|
149
|
+
},
|
|
150
|
+
)
|
|
151
|
+
.expect("blank ignore-from-file should be accepted");
|
|
152
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
use ryl::config::YamlLintConfig;
|
|
2
|
+
|
|
3
|
+
#[test]
|
|
4
|
+
fn error_when_allowed_values_not_sequence() {
|
|
5
|
+
let err =
|
|
6
|
+
YamlLintConfig::from_yaml_str("rules:\n truthy:\n allowed-values: foo\n")
|
|
7
|
+
.unwrap_err();
|
|
8
|
+
assert_eq!(
|
|
9
|
+
err,
|
|
10
|
+
"invalid config: option \"allowed-values\" of \"truthy\" should only contain values in ['YES', 'Yes', 'yes', 'NO', 'No', 'no', 'TRUE', 'True', 'true', 'FALSE', 'False', 'false', 'ON', 'On', 'on', 'OFF', 'Off', 'off']"
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[test]
|
|
15
|
+
fn error_when_allowed_values_has_invalid_entry() {
|
|
16
|
+
let err =
|
|
17
|
+
YamlLintConfig::from_yaml_str("rules:\n truthy:\n allowed-values: [foo]\n")
|
|
18
|
+
.unwrap_err();
|
|
19
|
+
assert_eq!(
|
|
20
|
+
err,
|
|
21
|
+
"invalid config: option \"allowed-values\" of \"truthy\" should only contain values in ['YES', 'Yes', 'yes', 'NO', 'No', 'no', 'TRUE', 'True', 'true', 'FALSE', 'False', 'false', 'ON', 'On', 'on', 'OFF', 'Off', 'off']"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[test]
|
|
26
|
+
fn error_when_allowed_values_contains_non_string() {
|
|
27
|
+
let err =
|
|
28
|
+
YamlLintConfig::from_yaml_str("rules:\n truthy:\n allowed-values: [1]\n")
|
|
29
|
+
.unwrap_err();
|
|
30
|
+
assert_eq!(
|
|
31
|
+
err,
|
|
32
|
+
"invalid config: option \"allowed-values\" of \"truthy\" should only contain values in ['YES', 'Yes', 'yes', 'NO', 'No', 'no', 'TRUE', 'True', 'true', 'FALSE', 'False', 'false', 'ON', 'On', 'on', 'OFF', 'Off', 'off']"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#[test]
|
|
37
|
+
fn error_when_check_keys_not_bool() {
|
|
38
|
+
let err = YamlLintConfig::from_yaml_str("rules:\n truthy:\n check-keys: 1\n")
|
|
39
|
+
.unwrap_err();
|
|
40
|
+
assert_eq!(
|
|
41
|
+
err,
|
|
42
|
+
"invalid config: option \"check-keys\" of \"truthy\" should be bool"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#[test]
|
|
47
|
+
fn error_on_unknown_truthy_option() {
|
|
48
|
+
let err = YamlLintConfig::from_yaml_str("rules:\n truthy:\n unknown: true\n")
|
|
49
|
+
.unwrap_err();
|
|
50
|
+
assert_eq!(
|
|
51
|
+
err,
|
|
52
|
+
"invalid config: unknown option \"unknown\" for rule \"truthy\""
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[test]
|
|
57
|
+
fn error_on_non_string_truthy_option_key() {
|
|
58
|
+
let err =
|
|
59
|
+
YamlLintConfig::from_yaml_str("rules:\n truthy:\n 1: true\n").unwrap_err();
|
|
60
|
+
assert_eq!(
|
|
61
|
+
err,
|
|
62
|
+
"invalid config: unknown option \"1\" for rule \"truthy\""
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#[test]
|
|
67
|
+
fn rule_option_returns_none_for_scalar_rule_value() {
|
|
68
|
+
let cfg = YamlLintConfig::from_yaml_str("rules:\n truthy: enable\n")
|
|
69
|
+
.expect("config parses");
|
|
70
|
+
assert!(cfg.rule_option("truthy", "allowed-values").is_none());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#[test]
|
|
74
|
+
fn rule_option_returns_none_when_rule_missing() {
|
|
75
|
+
let cfg = YamlLintConfig::from_yaml_str("rules: {}\n").expect("config parses");
|
|
76
|
+
assert!(cfg.rule_option("truthy", "allowed-values").is_none());
|
|
77
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
use ryl::config::{Overrides, discover_config};
|
|
2
|
+
|
|
3
|
+
#[test]
|
|
4
|
+
fn invalid_yaml_data_errors() {
|
|
5
|
+
let err = discover_config(
|
|
6
|
+
&[],
|
|
7
|
+
&Overrides {
|
|
8
|
+
config_file: None,
|
|
9
|
+
config_data: Some("[1]".into()),
|
|
10
|
+
},
|
|
11
|
+
)
|
|
12
|
+
.expect_err("top-level sequence should error");
|
|
13
|
+
assert!(err.contains("not a mapping"));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[test]
|
|
17
|
+
fn yaml_files_non_sequence_errors() {
|
|
18
|
+
let err = discover_config(
|
|
19
|
+
&[],
|
|
20
|
+
&Overrides {
|
|
21
|
+
config_file: None,
|
|
22
|
+
config_data: Some("yaml-files: 5\n".into()),
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
.expect_err("non-list yaml-files should error");
|
|
26
|
+
assert!(err.contains("yaml-files should be a list"));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[test]
|
|
30
|
+
fn yaml_files_invalid_pattern_is_skipped() {
|
|
31
|
+
let ctx = discover_config(
|
|
32
|
+
&[],
|
|
33
|
+
&Overrides {
|
|
34
|
+
config_file: None,
|
|
35
|
+
config_data: Some("yaml-files: ['[']\n".into()),
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
.expect("invalid glob should be ignored");
|
|
39
|
+
let base = ctx.base_dir.clone();
|
|
40
|
+
assert!(!ctx.config.is_yaml_candidate(&base.join("file.yaml"), &base));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[test]
|
|
44
|
+
fn yaml_files_negation_excludes_matches() {
|
|
45
|
+
let ctx = discover_config(
|
|
46
|
+
&[],
|
|
47
|
+
&Overrides {
|
|
48
|
+
config_file: None,
|
|
49
|
+
config_data: Some("yaml-files: ['*.yaml', '!skip.yaml']\n".into()),
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
.expect("yaml-files with negation should parse");
|
|
53
|
+
let base = ctx.base_dir.clone();
|
|
54
|
+
assert!(
|
|
55
|
+
ctx.config.is_yaml_candidate(&base.join("keep.yaml"), &base),
|
|
56
|
+
"positive pattern should include keep.yaml"
|
|
57
|
+
);
|
|
58
|
+
assert!(
|
|
59
|
+
!ctx.config.is_yaml_candidate(&base.join("skip.yaml"), &base),
|
|
60
|
+
"negated pattern should exclude skip.yaml"
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
use ryl::config::{Overrides, discover_config};
|
|
2
|
+
|
|
3
|
+
#[test]
|
|
4
|
+
fn yaml_files_sequence_all_non_strings_error() {
|
|
5
|
+
let yaml = "yaml-files: [1, 2]\nrules: {}\n";
|
|
6
|
+
let err = discover_config(
|
|
7
|
+
&[],
|
|
8
|
+
&Overrides {
|
|
9
|
+
config_file: None,
|
|
10
|
+
config_data: Some(yaml.into()),
|
|
11
|
+
},
|
|
12
|
+
)
|
|
13
|
+
.unwrap_err();
|
|
14
|
+
assert!(err.contains("invalid config"));
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
use std::fs;
|
|
2
|
+
use std::process::Command;
|
|
3
|
+
|
|
4
|
+
use tempfile::tempdir;
|
|
5
|
+
|
|
6
|
+
fn run(cmd: &mut Command) -> (i32, String, String) {
|
|
7
|
+
let out = cmd.output().expect("failed to run ryl");
|
|
8
|
+
let code = out.status.code().unwrap_or(-1);
|
|
9
|
+
let stdout = String::from_utf8_lossy(&out.stdout).into_owned();
|
|
10
|
+
let stderr = String::from_utf8_lossy(&out.stderr).into_owned();
|
|
11
|
+
(code, stdout, stderr)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[test]
|
|
15
|
+
fn empty_yaml_files_falls_back_to_extension_filtering() {
|
|
16
|
+
let td = tempdir().unwrap();
|
|
17
|
+
let root = td.path();
|
|
18
|
+
fs::write(root.join("a.yaml"), "a: 1\n").unwrap();
|
|
19
|
+
fs::write(root.join("b.txt"), "text\n").unwrap();
|
|
20
|
+
|
|
21
|
+
let exe = env!("CARGO_BIN_EXE_ryl");
|
|
22
|
+
let (code, out, err) = run(Command::new(exe)
|
|
23
|
+
.arg("--list-files")
|
|
24
|
+
.arg("-d")
|
|
25
|
+
.arg("yaml-files: []\n")
|
|
26
|
+
.arg(root));
|
|
27
|
+
assert_eq!(code, 0, "expected success: {err}");
|
|
28
|
+
assert!(out.contains("a.yaml"));
|
|
29
|
+
assert!(!out.contains("b.txt"));
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use ryl::rules::commas::{
|
|
2
|
+
Config, check, coverage_compute_spaces_before, coverage_skip_comment_crlf,
|
|
3
|
+
coverage_skip_zero_length_span,
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
#[test]
|
|
7
|
+
fn leading_comma_reports_zero_spaces() {
|
|
8
|
+
assert_eq!(coverage_compute_spaces_before(",", 0), Some(0));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[test]
|
|
12
|
+
fn leading_space_before_comma_counts_correctly() {
|
|
13
|
+
assert_eq!(coverage_compute_spaces_before(" ,", 1), Some(1));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[test]
|
|
17
|
+
fn newline_before_comma_is_ignored() {
|
|
18
|
+
assert_eq!(coverage_compute_spaces_before("\n,", 1), None);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#[test]
|
|
22
|
+
fn zero_length_scalar_span_is_ignored() {
|
|
23
|
+
assert_eq!(coverage_skip_zero_length_span(), 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#[test]
|
|
27
|
+
fn skip_comment_handles_crlf_lines() {
|
|
28
|
+
assert_eq!(coverage_skip_comment_crlf(), (2, 1));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[test]
|
|
32
|
+
fn stray_comma_outside_flow_is_ignored() {
|
|
33
|
+
let cfg = Config::new_for_tests(0, 1, 1);
|
|
34
|
+
assert!(check(",", &cfg).is_empty());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[test]
|
|
38
|
+
fn commas_after_multibyte_scalars_are_checked() {
|
|
39
|
+
let cfg = Config::new_for_tests(0, 1, 1);
|
|
40
|
+
let violations = check("[\"å\",\"b\"]", &cfg);
|
|
41
|
+
assert!(
|
|
42
|
+
violations
|
|
43
|
+
.iter()
|
|
44
|
+
.any(|v| v.message == "too few spaces after comma")
|
|
45
|
+
);
|
|
46
|
+
}
|