@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,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
-
cd "$project_root"
|
|
6
|
-
|
|
7
|
-
if ! command -v cargo >/dev/null 2>&1; then
|
|
8
|
-
echo "cargo is required to run this script" >&2
|
|
9
|
-
exit 1
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
if ! command -v jq >/dev/null 2>&1; then
|
|
13
|
-
echo "jq is required to run this script" >&2
|
|
14
|
-
exit 1
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
if ! cargo llvm-cov nextest --summary-only >/dev/null 2>&1; then
|
|
18
|
-
echo "cargo llvm-cov nextest --summary-only failed; inspect the output above for details." >&2
|
|
19
|
-
exit 1
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
prefix="${project_root}/"
|
|
23
|
-
tmp_json="$(mktemp)"
|
|
24
|
-
trap 'rm -f "$tmp_json"' EXIT
|
|
25
|
-
|
|
26
|
-
cargo llvm-cov report --json --output-path "$tmp_json" >/dev/null 2>&1 || {
|
|
27
|
-
echo "Failed to generate coverage report." >&2
|
|
28
|
-
exit 1
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
report=$(jq -r --arg prefix "$prefix" '
|
|
32
|
-
def ranges:
|
|
33
|
-
sort
|
|
34
|
-
| unique
|
|
35
|
-
| reduce .[] as $line ([];
|
|
36
|
-
if length > 0 and $line == (.[-1][1] + 1) then
|
|
37
|
-
(.[-1] = [.[-1][0], $line])
|
|
38
|
-
else
|
|
39
|
-
. + [[ $line, $line ]]
|
|
40
|
-
end)
|
|
41
|
-
| map(if .[0] == .[1] then (.[0] | tostring) else "\(.[0])-\(.[1])" end);
|
|
42
|
-
|
|
43
|
-
.data[].files[]
|
|
44
|
-
| select(.summary.regions.percent < 100)
|
|
45
|
-
| {file: (.filename | sub("^" + $prefix; "")),
|
|
46
|
-
uncovered: [ .segments[]
|
|
47
|
-
| select(.[2] == 0 and .[3] == true and .[5] == false)
|
|
48
|
-
| .[0]
|
|
49
|
-
] }
|
|
50
|
-
| select(.uncovered | length > 0)
|
|
51
|
-
| "\(.file):\(.uncovered | ranges | join(","))"
|
|
52
|
-
' "$tmp_json")
|
|
53
|
-
|
|
54
|
-
if [[ -z "$report" ]]; then
|
|
55
|
-
echo "Coverage OK: no uncovered regions."
|
|
56
|
-
else
|
|
57
|
-
echo "Uncovered regions (file:path line ranges):"
|
|
58
|
-
printf '%s
|
|
59
|
-
' "$report"
|
|
60
|
-
fi
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#![forbid(unsafe_code)]
|
|
2
|
-
#![deny(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
|
|
3
|
-
|
|
4
|
-
use std::env;
|
|
5
|
-
use std::path::PathBuf;
|
|
6
|
-
|
|
7
|
-
use ryl::config::{Overrides, discover_config};
|
|
8
|
-
|
|
9
|
-
fn main() {
|
|
10
|
-
let dir = env::args()
|
|
11
|
-
.nth(1)
|
|
12
|
-
.map_or_else(|| PathBuf::from("."), PathBuf::from);
|
|
13
|
-
let inputs = vec![dir];
|
|
14
|
-
match discover_config(&inputs, &Overrides::default()) {
|
|
15
|
-
Ok(ctx) => match ctx.source {
|
|
16
|
-
Some(p) => println!("{}", p.display()),
|
|
17
|
-
None => println!(),
|
|
18
|
-
},
|
|
19
|
-
Err(e) => {
|
|
20
|
-
eprintln!("{e}");
|
|
21
|
-
std::process::exit(2);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/cli_support.rs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
use std::collections::HashMap;
|
|
2
|
-
use std::hash::BuildHasher;
|
|
3
|
-
use std::path::{Path, PathBuf};
|
|
4
|
-
|
|
5
|
-
use crate::config::{ConfigContext, YamlLintConfig, discover_per_file};
|
|
6
|
-
|
|
7
|
-
/// Resolve the configuration context for a given file path, optionally using a cached
|
|
8
|
-
/// global configuration.
|
|
9
|
-
///
|
|
10
|
-
/// This mirrors the logic used by the CLI when filtering candidate files.
|
|
11
|
-
///
|
|
12
|
-
/// # Errors
|
|
13
|
-
/// Returns an error when configuration discovery fails for the provided path.
|
|
14
|
-
pub fn resolve_ctx<S: BuildHasher>(
|
|
15
|
-
path: &Path,
|
|
16
|
-
global_cfg: Option<&ConfigContext>,
|
|
17
|
-
cache: &mut HashMap<PathBuf, (PathBuf, YamlLintConfig), S>,
|
|
18
|
-
) -> Result<(PathBuf, YamlLintConfig, Vec<String>), String> {
|
|
19
|
-
if let Some(gc) = global_cfg {
|
|
20
|
-
return Ok((gc.base_dir.clone(), gc.config.clone(), Vec::new()));
|
|
21
|
-
}
|
|
22
|
-
let start = path
|
|
23
|
-
.parent()
|
|
24
|
-
.map_or_else(|| PathBuf::from("."), PathBuf::from);
|
|
25
|
-
if let Some(pair) = cache.get(&start).cloned() {
|
|
26
|
-
return Ok((pair.0, pair.1, Vec::new()));
|
|
27
|
-
}
|
|
28
|
-
let ctx = discover_per_file(path)?;
|
|
29
|
-
let pair = (ctx.base_dir.clone(), ctx.config);
|
|
30
|
-
let notices = ctx.notices;
|
|
31
|
-
cache.insert(start, pair.clone());
|
|
32
|
-
Ok((pair.0, pair.1, notices))
|
|
33
|
-
}
|
package/src/conf/mod.rs
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#![allow(clippy::module_name_repetitions)]
|
|
2
|
-
|
|
3
|
-
// Built-in presets to support `extends`, mirroring yamllint.
|
|
4
|
-
|
|
5
|
-
#[must_use]
|
|
6
|
-
pub fn builtin(name: &str) -> Option<&'static str> {
|
|
7
|
-
match name {
|
|
8
|
-
"default" => Some(DEFAULT),
|
|
9
|
-
"relaxed" => Some(RELAXED),
|
|
10
|
-
"empty" => Some(EMPTY),
|
|
11
|
-
_ => None,
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const DEFAULT: &str = r"---
|
|
16
|
-
|
|
17
|
-
yaml-files:
|
|
18
|
-
- '*.yaml'
|
|
19
|
-
- '*.yml'
|
|
20
|
-
- '.yamllint'
|
|
21
|
-
|
|
22
|
-
rules:
|
|
23
|
-
anchors: enable
|
|
24
|
-
braces: enable
|
|
25
|
-
brackets: enable
|
|
26
|
-
colons: enable
|
|
27
|
-
commas: enable
|
|
28
|
-
comments:
|
|
29
|
-
level: warning
|
|
30
|
-
comments-indentation:
|
|
31
|
-
level: warning
|
|
32
|
-
document-end: disable
|
|
33
|
-
document-start:
|
|
34
|
-
level: warning
|
|
35
|
-
empty-lines: enable
|
|
36
|
-
empty-values: disable
|
|
37
|
-
float-values: disable
|
|
38
|
-
hyphens: enable
|
|
39
|
-
indentation: enable
|
|
40
|
-
key-duplicates: enable
|
|
41
|
-
key-ordering: disable
|
|
42
|
-
line-length: enable
|
|
43
|
-
new-line-at-end-of-file: enable
|
|
44
|
-
new-lines: enable
|
|
45
|
-
octal-values: disable
|
|
46
|
-
quoted-strings: disable
|
|
47
|
-
trailing-spaces: enable
|
|
48
|
-
truthy:
|
|
49
|
-
level: warning
|
|
50
|
-
";
|
|
51
|
-
|
|
52
|
-
const RELAXED: &str = r"---
|
|
53
|
-
|
|
54
|
-
extends: default
|
|
55
|
-
|
|
56
|
-
rules:
|
|
57
|
-
braces:
|
|
58
|
-
level: warning
|
|
59
|
-
max-spaces-inside: 1
|
|
60
|
-
brackets:
|
|
61
|
-
level: warning
|
|
62
|
-
max-spaces-inside: 1
|
|
63
|
-
colons:
|
|
64
|
-
level: warning
|
|
65
|
-
commas:
|
|
66
|
-
level: warning
|
|
67
|
-
comments: disable
|
|
68
|
-
comments-indentation: disable
|
|
69
|
-
document-start: disable
|
|
70
|
-
empty-lines:
|
|
71
|
-
level: warning
|
|
72
|
-
hyphens:
|
|
73
|
-
level: warning
|
|
74
|
-
indentation:
|
|
75
|
-
level: warning
|
|
76
|
-
indent-sequences: consistent
|
|
77
|
-
line-length:
|
|
78
|
-
level: warning
|
|
79
|
-
allow-non-breakable-inline-mappings: true
|
|
80
|
-
truthy: disable
|
|
81
|
-
";
|
|
82
|
-
|
|
83
|
-
const EMPTY: &str = r"
|
|
84
|
-
rules: {}
|
|
85
|
-
";
|