@owenlamont/ryl 0.4.1 → 0.4.2
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/README.md +13 -0
- package/bin/ryl.js +195 -1
- package/package.json +35 -13
- package/.github/CODEOWNERS +0 -1
- package/.github/dependabot.yml +0 -13
- package/.github/workflows/ci.yml +0 -107
- package/.github/workflows/release.yml +0 -613
- package/.github/workflows/update_dependencies.yml +0 -61
- package/.github/workflows/update_linters.yml +0 -56
- package/.pre-commit-config.yaml +0 -87
- package/.yamllint +0 -4
- package/AGENTS.md +0 -200
- package/Cargo.lock +0 -908
- package/Cargo.toml +0 -32
- package/clippy.toml +0 -1
- package/docs/config-presets.md +0 -100
- package/img/benchmark-5x5-5runs.svg +0 -2176
- package/pyproject.toml +0 -42
- package/ruff.toml +0 -107
- package/rumdl.toml +0 -20
- package/rust-toolchain.toml +0 -3
- package/rustfmt.toml +0 -3
- package/scripts/benchmark_perf_vs_yamllint.py +0 -400
- package/scripts/coverage-missing.ps1 +0 -80
- package/scripts/coverage-missing.sh +0 -60
- package/src/bin/discover_config_bin.rs +0 -24
- package/src/cli_support.rs +0 -33
- package/src/conf/mod.rs +0 -85
- package/src/config.rs +0 -2099
- package/src/decoder.rs +0 -326
- package/src/discover.rs +0 -31
- package/src/lib.rs +0 -19
- package/src/lint.rs +0 -558
- package/src/main.rs +0 -535
- package/src/migrate.rs +0 -233
- package/src/rules/anchors.rs +0 -517
- package/src/rules/braces.rs +0 -77
- package/src/rules/brackets.rs +0 -77
- package/src/rules/colons.rs +0 -475
- package/src/rules/commas.rs +0 -372
- package/src/rules/comments.rs +0 -299
- package/src/rules/comments_indentation.rs +0 -243
- package/src/rules/document_end.rs +0 -175
- package/src/rules/document_start.rs +0 -84
- package/src/rules/empty_lines.rs +0 -152
- package/src/rules/empty_values.rs +0 -255
- package/src/rules/float_values.rs +0 -259
- package/src/rules/flow_collection.rs +0 -562
- package/src/rules/hyphens.rs +0 -104
- package/src/rules/indentation.rs +0 -803
- package/src/rules/key_duplicates.rs +0 -218
- package/src/rules/key_ordering.rs +0 -303
- package/src/rules/line_length.rs +0 -326
- package/src/rules/mod.rs +0 -25
- package/src/rules/new_line_at_end_of_file.rs +0 -23
- package/src/rules/new_lines.rs +0 -95
- package/src/rules/octal_values.rs +0 -121
- package/src/rules/quoted_strings.rs +0 -577
- package/src/rules/span_utils.rs +0 -37
- package/src/rules/trailing_spaces.rs +0 -65
- package/src/rules/truthy.rs +0 -420
- package/tests/brackets_carriage_return.rs +0 -114
- package/tests/build_global_cfg_error.rs +0 -23
- package/tests/cli_anchors_rule.rs +0 -143
- package/tests/cli_braces_rule.rs +0 -104
- package/tests/cli_brackets_rule.rs +0 -104
- package/tests/cli_colons_rule.rs +0 -65
- package/tests/cli_commas_rule.rs +0 -104
- package/tests/cli_comments_indentation_rule.rs +0 -61
- package/tests/cli_comments_rule.rs +0 -67
- package/tests/cli_config_data_error.rs +0 -30
- package/tests/cli_config_flags.rs +0 -66
- package/tests/cli_config_migrate.rs +0 -229
- package/tests/cli_document_end_rule.rs +0 -92
- package/tests/cli_document_start_rule.rs +0 -92
- package/tests/cli_empty_lines_rule.rs +0 -87
- package/tests/cli_empty_values_rule.rs +0 -68
- package/tests/cli_env_config.rs +0 -34
- package/tests/cli_exit_and_errors.rs +0 -41
- package/tests/cli_file_encoding.rs +0 -203
- package/tests/cli_float_values_rule.rs +0 -64
- package/tests/cli_format_options.rs +0 -316
- package/tests/cli_global_cfg_relaxed.rs +0 -20
- package/tests/cli_hyphens_rule.rs +0 -104
- package/tests/cli_indentation_rule.rs +0 -65
- package/tests/cli_invalid_project_config.rs +0 -39
- package/tests/cli_key_duplicates_rule.rs +0 -104
- package/tests/cli_key_ordering_rule.rs +0 -59
- package/tests/cli_line_length_rule.rs +0 -85
- package/tests/cli_list_files.rs +0 -29
- package/tests/cli_new_line_rule.rs +0 -141
- package/tests/cli_new_lines_rule.rs +0 -119
- package/tests/cli_octal_values_rule.rs +0 -60
- package/tests/cli_quoted_strings_rule.rs +0 -47
- package/tests/cli_toml_config.rs +0 -119
- package/tests/cli_trailing_spaces_rule.rs +0 -77
- package/tests/cli_truthy_rule.rs +0 -83
- package/tests/cli_yaml_files_negation.rs +0 -45
- package/tests/colons_rule.rs +0 -303
- package/tests/common/compat.rs +0 -114
- package/tests/common/fake_env.rs +0 -93
- package/tests/common/mod.rs +0 -1
- package/tests/conf_builtin.rs +0 -9
- package/tests/config_anchors.rs +0 -84
- package/tests/config_braces.rs +0 -121
- package/tests/config_brackets.rs +0 -127
- package/tests/config_commas.rs +0 -79
- package/tests/config_comments.rs +0 -65
- package/tests/config_comments_indentation.rs +0 -20
- package/tests/config_deep_merge_nonstring_key.rs +0 -24
- package/tests/config_document_end.rs +0 -54
- package/tests/config_document_start.rs +0 -55
- package/tests/config_empty_lines.rs +0 -48
- package/tests/config_empty_values.rs +0 -35
- package/tests/config_env_errors.rs +0 -23
- package/tests/config_env_invalid_inline.rs +0 -15
- package/tests/config_env_missing.rs +0 -63
- package/tests/config_env_shim.rs +0 -301
- package/tests/config_explicit_file_parse_error.rs +0 -55
- package/tests/config_extended_features.rs +0 -225
- package/tests/config_extends_inline.rs +0 -185
- package/tests/config_extends_sequence.rs +0 -18
- package/tests/config_find_project_home_boundary.rs +0 -54
- package/tests/config_find_project_two_files_in_cwd.rs +0 -47
- package/tests/config_float_values.rs +0 -34
- package/tests/config_from_yaml_paths.rs +0 -32
- package/tests/config_hyphens.rs +0 -51
- package/tests/config_ignore_errors.rs +0 -243
- package/tests/config_ignore_overrides.rs +0 -83
- package/tests/config_indentation.rs +0 -65
- package/tests/config_invalid_globs.rs +0 -16
- package/tests/config_invalid_types.rs +0 -19
- package/tests/config_key_duplicates.rs +0 -34
- package/tests/config_key_ordering.rs +0 -70
- package/tests/config_line_length.rs +0 -65
- package/tests/config_locale.rs +0 -111
- package/tests/config_merge.rs +0 -26
- package/tests/config_new_lines.rs +0 -89
- package/tests/config_octal_values.rs +0 -33
- package/tests/config_quoted_strings.rs +0 -195
- package/tests/config_rule_level.rs +0 -147
- package/tests/config_rules_non_string_keys.rs +0 -23
- package/tests/config_scalar_overrides.rs +0 -27
- package/tests/config_to_toml.rs +0 -110
- package/tests/config_toml_coverage.rs +0 -80
- package/tests/config_toml_discovery.rs +0 -304
- package/tests/config_trailing_spaces.rs +0 -152
- package/tests/config_truthy.rs +0 -77
- package/tests/config_yaml_files.rs +0 -62
- package/tests/config_yaml_files_all_non_string.rs +0 -15
- package/tests/config_yaml_files_empty.rs +0 -30
- package/tests/coverage_commas.rs +0 -46
- package/tests/decoder_decode.rs +0 -338
- package/tests/discover_config_bin_all.rs +0 -66
- package/tests/discover_config_bin_env_invalid_yaml.rs +0 -26
- package/tests/discover_config_bin_project_config_parse_error.rs +0 -24
- package/tests/discover_config_bin_user_global_error.rs +0 -26
- package/tests/discover_module.rs +0 -30
- package/tests/discover_per_file_dir.rs +0 -10
- package/tests/discover_per_file_project_config_error.rs +0 -21
- package/tests/float_values.rs +0 -43
- package/tests/lint_multi_errors.rs +0 -32
- package/tests/main_yaml_ok_filtering.rs +0 -30
- package/tests/migrate_module.rs +0 -259
- package/tests/resolve_ctx_empty_parent.rs +0 -16
- package/tests/rule_anchors.rs +0 -442
- package/tests/rule_braces.rs +0 -258
- package/tests/rule_brackets.rs +0 -217
- package/tests/rule_commas.rs +0 -205
- package/tests/rule_comments.rs +0 -197
- package/tests/rule_comments_indentation.rs +0 -127
- package/tests/rule_document_end.rs +0 -118
- package/tests/rule_document_start.rs +0 -60
- package/tests/rule_empty_lines.rs +0 -96
- package/tests/rule_empty_values.rs +0 -102
- package/tests/rule_float_values.rs +0 -109
- package/tests/rule_hyphens.rs +0 -65
- package/tests/rule_indentation.rs +0 -455
- package/tests/rule_key_duplicates.rs +0 -76
- package/tests/rule_key_ordering.rs +0 -207
- package/tests/rule_line_length.rs +0 -200
- package/tests/rule_new_lines.rs +0 -51
- package/tests/rule_octal_values.rs +0 -53
- package/tests/rule_quoted_strings.rs +0 -290
- package/tests/rule_trailing_spaces.rs +0 -41
- package/tests/rule_truthy.rs +0 -236
- package/tests/user_global_invalid_yaml.rs +0 -32
- package/tests/yamllint_compat_anchors.rs +0 -280
- package/tests/yamllint_compat_braces.rs +0 -411
- package/tests/yamllint_compat_brackets.rs +0 -364
- package/tests/yamllint_compat_colons.rs +0 -298
- package/tests/yamllint_compat_colors.rs +0 -80
- package/tests/yamllint_compat_commas.rs +0 -375
- package/tests/yamllint_compat_comments.rs +0 -167
- package/tests/yamllint_compat_comments_indentation.rs +0 -281
- package/tests/yamllint_compat_config.rs +0 -170
- package/tests/yamllint_compat_document_end.rs +0 -243
- package/tests/yamllint_compat_document_start.rs +0 -136
- package/tests/yamllint_compat_empty_lines.rs +0 -117
- package/tests/yamllint_compat_empty_values.rs +0 -179
- package/tests/yamllint_compat_float_values.rs +0 -216
- package/tests/yamllint_compat_hyphens.rs +0 -223
- package/tests/yamllint_compat_indentation.rs +0 -398
- package/tests/yamllint_compat_key_duplicates.rs +0 -139
- package/tests/yamllint_compat_key_ordering.rs +0 -170
- package/tests/yamllint_compat_line_length.rs +0 -375
- package/tests/yamllint_compat_list.rs +0 -127
- package/tests/yamllint_compat_new_line.rs +0 -133
- package/tests/yamllint_compat_newline_types.rs +0 -185
- package/tests/yamllint_compat_octal_values.rs +0 -172
- package/tests/yamllint_compat_quoted_strings.rs +0 -154
- package/tests/yamllint_compat_syntax.rs +0 -200
- package/tests/yamllint_compat_trailing_spaces.rs +0 -162
- package/tests/yamllint_compat_truthy.rs +0 -130
- package/tests/yamllint_compat_yaml_files.rs +0 -81
- package/typos.toml +0 -2
|
@@ -1,304 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
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
|
-
}
|
package/tests/config_truthy.rs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
package/tests/coverage_commas.rs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
}
|