@owenlamont/ryl 0.4.1 → 0.4.3

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.
Files changed (217) hide show
  1. package/README.md +13 -0
  2. package/bin/ryl.js +96 -1
  3. package/npm-platforms.json +124 -0
  4. package/package.json +46 -12
  5. package/.github/CODEOWNERS +0 -1
  6. package/.github/dependabot.yml +0 -13
  7. package/.github/workflows/ci.yml +0 -107
  8. package/.github/workflows/release.yml +0 -613
  9. package/.github/workflows/update_dependencies.yml +0 -61
  10. package/.github/workflows/update_linters.yml +0 -56
  11. package/.pre-commit-config.yaml +0 -87
  12. package/.yamllint +0 -4
  13. package/AGENTS.md +0 -200
  14. package/Cargo.lock +0 -908
  15. package/Cargo.toml +0 -32
  16. package/clippy.toml +0 -1
  17. package/docs/config-presets.md +0 -100
  18. package/img/benchmark-5x5-5runs.svg +0 -2176
  19. package/pyproject.toml +0 -42
  20. package/ruff.toml +0 -107
  21. package/rumdl.toml +0 -20
  22. package/rust-toolchain.toml +0 -3
  23. package/rustfmt.toml +0 -3
  24. package/scripts/benchmark_perf_vs_yamllint.py +0 -400
  25. package/scripts/coverage-missing.ps1 +0 -80
  26. package/scripts/coverage-missing.sh +0 -60
  27. package/src/bin/discover_config_bin.rs +0 -24
  28. package/src/cli_support.rs +0 -33
  29. package/src/conf/mod.rs +0 -85
  30. package/src/config.rs +0 -2099
  31. package/src/decoder.rs +0 -326
  32. package/src/discover.rs +0 -31
  33. package/src/lib.rs +0 -19
  34. package/src/lint.rs +0 -558
  35. package/src/main.rs +0 -535
  36. package/src/migrate.rs +0 -233
  37. package/src/rules/anchors.rs +0 -517
  38. package/src/rules/braces.rs +0 -77
  39. package/src/rules/brackets.rs +0 -77
  40. package/src/rules/colons.rs +0 -475
  41. package/src/rules/commas.rs +0 -372
  42. package/src/rules/comments.rs +0 -299
  43. package/src/rules/comments_indentation.rs +0 -243
  44. package/src/rules/document_end.rs +0 -175
  45. package/src/rules/document_start.rs +0 -84
  46. package/src/rules/empty_lines.rs +0 -152
  47. package/src/rules/empty_values.rs +0 -255
  48. package/src/rules/float_values.rs +0 -259
  49. package/src/rules/flow_collection.rs +0 -562
  50. package/src/rules/hyphens.rs +0 -104
  51. package/src/rules/indentation.rs +0 -803
  52. package/src/rules/key_duplicates.rs +0 -218
  53. package/src/rules/key_ordering.rs +0 -303
  54. package/src/rules/line_length.rs +0 -326
  55. package/src/rules/mod.rs +0 -25
  56. package/src/rules/new_line_at_end_of_file.rs +0 -23
  57. package/src/rules/new_lines.rs +0 -95
  58. package/src/rules/octal_values.rs +0 -121
  59. package/src/rules/quoted_strings.rs +0 -577
  60. package/src/rules/span_utils.rs +0 -37
  61. package/src/rules/trailing_spaces.rs +0 -65
  62. package/src/rules/truthy.rs +0 -420
  63. package/tests/brackets_carriage_return.rs +0 -114
  64. package/tests/build_global_cfg_error.rs +0 -23
  65. package/tests/cli_anchors_rule.rs +0 -143
  66. package/tests/cli_braces_rule.rs +0 -104
  67. package/tests/cli_brackets_rule.rs +0 -104
  68. package/tests/cli_colons_rule.rs +0 -65
  69. package/tests/cli_commas_rule.rs +0 -104
  70. package/tests/cli_comments_indentation_rule.rs +0 -61
  71. package/tests/cli_comments_rule.rs +0 -67
  72. package/tests/cli_config_data_error.rs +0 -30
  73. package/tests/cli_config_flags.rs +0 -66
  74. package/tests/cli_config_migrate.rs +0 -229
  75. package/tests/cli_document_end_rule.rs +0 -92
  76. package/tests/cli_document_start_rule.rs +0 -92
  77. package/tests/cli_empty_lines_rule.rs +0 -87
  78. package/tests/cli_empty_values_rule.rs +0 -68
  79. package/tests/cli_env_config.rs +0 -34
  80. package/tests/cli_exit_and_errors.rs +0 -41
  81. package/tests/cli_file_encoding.rs +0 -203
  82. package/tests/cli_float_values_rule.rs +0 -64
  83. package/tests/cli_format_options.rs +0 -316
  84. package/tests/cli_global_cfg_relaxed.rs +0 -20
  85. package/tests/cli_hyphens_rule.rs +0 -104
  86. package/tests/cli_indentation_rule.rs +0 -65
  87. package/tests/cli_invalid_project_config.rs +0 -39
  88. package/tests/cli_key_duplicates_rule.rs +0 -104
  89. package/tests/cli_key_ordering_rule.rs +0 -59
  90. package/tests/cli_line_length_rule.rs +0 -85
  91. package/tests/cli_list_files.rs +0 -29
  92. package/tests/cli_new_line_rule.rs +0 -141
  93. package/tests/cli_new_lines_rule.rs +0 -119
  94. package/tests/cli_octal_values_rule.rs +0 -60
  95. package/tests/cli_quoted_strings_rule.rs +0 -47
  96. package/tests/cli_toml_config.rs +0 -119
  97. package/tests/cli_trailing_spaces_rule.rs +0 -77
  98. package/tests/cli_truthy_rule.rs +0 -83
  99. package/tests/cli_yaml_files_negation.rs +0 -45
  100. package/tests/colons_rule.rs +0 -303
  101. package/tests/common/compat.rs +0 -114
  102. package/tests/common/fake_env.rs +0 -93
  103. package/tests/common/mod.rs +0 -1
  104. package/tests/conf_builtin.rs +0 -9
  105. package/tests/config_anchors.rs +0 -84
  106. package/tests/config_braces.rs +0 -121
  107. package/tests/config_brackets.rs +0 -127
  108. package/tests/config_commas.rs +0 -79
  109. package/tests/config_comments.rs +0 -65
  110. package/tests/config_comments_indentation.rs +0 -20
  111. package/tests/config_deep_merge_nonstring_key.rs +0 -24
  112. package/tests/config_document_end.rs +0 -54
  113. package/tests/config_document_start.rs +0 -55
  114. package/tests/config_empty_lines.rs +0 -48
  115. package/tests/config_empty_values.rs +0 -35
  116. package/tests/config_env_errors.rs +0 -23
  117. package/tests/config_env_invalid_inline.rs +0 -15
  118. package/tests/config_env_missing.rs +0 -63
  119. package/tests/config_env_shim.rs +0 -301
  120. package/tests/config_explicit_file_parse_error.rs +0 -55
  121. package/tests/config_extended_features.rs +0 -225
  122. package/tests/config_extends_inline.rs +0 -185
  123. package/tests/config_extends_sequence.rs +0 -18
  124. package/tests/config_find_project_home_boundary.rs +0 -54
  125. package/tests/config_find_project_two_files_in_cwd.rs +0 -47
  126. package/tests/config_float_values.rs +0 -34
  127. package/tests/config_from_yaml_paths.rs +0 -32
  128. package/tests/config_hyphens.rs +0 -51
  129. package/tests/config_ignore_errors.rs +0 -243
  130. package/tests/config_ignore_overrides.rs +0 -83
  131. package/tests/config_indentation.rs +0 -65
  132. package/tests/config_invalid_globs.rs +0 -16
  133. package/tests/config_invalid_types.rs +0 -19
  134. package/tests/config_key_duplicates.rs +0 -34
  135. package/tests/config_key_ordering.rs +0 -70
  136. package/tests/config_line_length.rs +0 -65
  137. package/tests/config_locale.rs +0 -111
  138. package/tests/config_merge.rs +0 -26
  139. package/tests/config_new_lines.rs +0 -89
  140. package/tests/config_octal_values.rs +0 -33
  141. package/tests/config_quoted_strings.rs +0 -195
  142. package/tests/config_rule_level.rs +0 -147
  143. package/tests/config_rules_non_string_keys.rs +0 -23
  144. package/tests/config_scalar_overrides.rs +0 -27
  145. package/tests/config_to_toml.rs +0 -110
  146. package/tests/config_toml_coverage.rs +0 -80
  147. package/tests/config_toml_discovery.rs +0 -304
  148. package/tests/config_trailing_spaces.rs +0 -152
  149. package/tests/config_truthy.rs +0 -77
  150. package/tests/config_yaml_files.rs +0 -62
  151. package/tests/config_yaml_files_all_non_string.rs +0 -15
  152. package/tests/config_yaml_files_empty.rs +0 -30
  153. package/tests/coverage_commas.rs +0 -46
  154. package/tests/decoder_decode.rs +0 -338
  155. package/tests/discover_config_bin_all.rs +0 -66
  156. package/tests/discover_config_bin_env_invalid_yaml.rs +0 -26
  157. package/tests/discover_config_bin_project_config_parse_error.rs +0 -24
  158. package/tests/discover_config_bin_user_global_error.rs +0 -26
  159. package/tests/discover_module.rs +0 -30
  160. package/tests/discover_per_file_dir.rs +0 -10
  161. package/tests/discover_per_file_project_config_error.rs +0 -21
  162. package/tests/float_values.rs +0 -43
  163. package/tests/lint_multi_errors.rs +0 -32
  164. package/tests/main_yaml_ok_filtering.rs +0 -30
  165. package/tests/migrate_module.rs +0 -259
  166. package/tests/resolve_ctx_empty_parent.rs +0 -16
  167. package/tests/rule_anchors.rs +0 -442
  168. package/tests/rule_braces.rs +0 -258
  169. package/tests/rule_brackets.rs +0 -217
  170. package/tests/rule_commas.rs +0 -205
  171. package/tests/rule_comments.rs +0 -197
  172. package/tests/rule_comments_indentation.rs +0 -127
  173. package/tests/rule_document_end.rs +0 -118
  174. package/tests/rule_document_start.rs +0 -60
  175. package/tests/rule_empty_lines.rs +0 -96
  176. package/tests/rule_empty_values.rs +0 -102
  177. package/tests/rule_float_values.rs +0 -109
  178. package/tests/rule_hyphens.rs +0 -65
  179. package/tests/rule_indentation.rs +0 -455
  180. package/tests/rule_key_duplicates.rs +0 -76
  181. package/tests/rule_key_ordering.rs +0 -207
  182. package/tests/rule_line_length.rs +0 -200
  183. package/tests/rule_new_lines.rs +0 -51
  184. package/tests/rule_octal_values.rs +0 -53
  185. package/tests/rule_quoted_strings.rs +0 -290
  186. package/tests/rule_trailing_spaces.rs +0 -41
  187. package/tests/rule_truthy.rs +0 -236
  188. package/tests/user_global_invalid_yaml.rs +0 -32
  189. package/tests/yamllint_compat_anchors.rs +0 -280
  190. package/tests/yamllint_compat_braces.rs +0 -411
  191. package/tests/yamllint_compat_brackets.rs +0 -364
  192. package/tests/yamllint_compat_colons.rs +0 -298
  193. package/tests/yamllint_compat_colors.rs +0 -80
  194. package/tests/yamllint_compat_commas.rs +0 -375
  195. package/tests/yamllint_compat_comments.rs +0 -167
  196. package/tests/yamllint_compat_comments_indentation.rs +0 -281
  197. package/tests/yamllint_compat_config.rs +0 -170
  198. package/tests/yamllint_compat_document_end.rs +0 -243
  199. package/tests/yamllint_compat_document_start.rs +0 -136
  200. package/tests/yamllint_compat_empty_lines.rs +0 -117
  201. package/tests/yamllint_compat_empty_values.rs +0 -179
  202. package/tests/yamllint_compat_float_values.rs +0 -216
  203. package/tests/yamllint_compat_hyphens.rs +0 -223
  204. package/tests/yamllint_compat_indentation.rs +0 -398
  205. package/tests/yamllint_compat_key_duplicates.rs +0 -139
  206. package/tests/yamllint_compat_key_ordering.rs +0 -170
  207. package/tests/yamllint_compat_line_length.rs +0 -375
  208. package/tests/yamllint_compat_list.rs +0 -127
  209. package/tests/yamllint_compat_new_line.rs +0 -133
  210. package/tests/yamllint_compat_newline_types.rs +0 -185
  211. package/tests/yamllint_compat_octal_values.rs +0 -172
  212. package/tests/yamllint_compat_quoted_strings.rs +0 -154
  213. package/tests/yamllint_compat_syntax.rs +0 -200
  214. package/tests/yamllint_compat_trailing_spaces.rs +0 -162
  215. package/tests/yamllint_compat_truthy.rs +0 -130
  216. package/tests/yamllint_compat_yaml_files.rs +0 -81
  217. package/typos.toml +0 -2
@@ -1,56 +0,0 @@
1
- name: Update Linters
2
- on:
3
- schedule:
4
- - cron: '30 8 * * 6' # Saturday 18:00 UTC+9:30
5
- workflow_dispatch:
6
-
7
- jobs:
8
- refresh-pre-commit-config:
9
- runs-on: ubuntu-latest
10
- environment: automation
11
- permissions:
12
- contents: write
13
- pull-requests: write
14
- steps:
15
- - name: Checkout repository
16
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
17
-
18
- - name: Install uv
19
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
20
-
21
- - name: Install prek
22
- run: uv tool install prek --force
23
-
24
- - name: Run prek autoupdate
25
- run: prek autoupdate
26
-
27
- - name: Check for changes in .pre-commit-config.yaml
28
- id: check_diff
29
- run: |
30
- if git diff --quiet .pre-commit-config.yaml; then
31
- echo "changed=false" >> $GITHUB_OUTPUT
32
- else
33
- echo "changed=true" >> $GITHUB_OUTPUT
34
- fi
35
-
36
- - name: Generate token
37
- if: steps.check_diff.outputs.changed == 'true'
38
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
39
- id: generate-token
40
- with:
41
- app-id: ${{ secrets.AUTH_APP_CLIENT_ID }}
42
- private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
43
-
44
- - name: Create PR with updated .pre-commit-config.yaml
45
- if: steps.check_diff.outputs.changed == 'true'
46
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
47
- with:
48
- token: ${{ steps.generate-token.outputs.token }}
49
- commit-message: "chore: refresh .pre-commit-config.yaml"
50
- title: "chore: refresh .pre-commit-config.yaml"
51
- body: |
52
- This PR updates `.pre-commit-config.yaml` by running `prek autoupdate`.
53
- It was triggered automatically (or manually) to keep linters up-to-date.
54
- branch: bot/pre-commit-config-refresh
55
- author: GitHub Actions <actions@github.com>
56
- delete-branch: true
@@ -1,87 +0,0 @@
1
- # See https://pre-commit.com for more information
2
- # See https://pre-commit.com/hooks.html for more hooks
3
- repos:
4
- - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v6.0.0
6
- hooks:
7
- - id: trailing-whitespace
8
- - id: end-of-file-fixer
9
- - id: check-case-conflict
10
- - id: destroyed-symlinks
11
- - id: check-illegal-windows-names
12
- - id: check-merge-conflict
13
- - id: check-symlinks
14
- - id: check-toml
15
- - id: check-xml
16
- - id: check-yaml
17
- - id: check-added-large-files
18
- - id: check-merge-conflict
19
- - id: no-commit-to-branch
20
- - id: pretty-format-json
21
- args: [--autofix]
22
- - id: mixed-line-ending
23
- args: [--fix=lf]
24
- - repo: https://github.com/shellcheck-py/shellcheck-py
25
- rev: v0.11.0.1
26
- hooks:
27
- - id: shellcheck
28
- args: [--severity=style]
29
- files: ^scripts/.*\.sh$
30
- - repo: local
31
- hooks:
32
- - id: cargo-check
33
- name: cargo check
34
- entry: cargo check --workspace
35
- language: system
36
- types: [rust]
37
- pass_filenames: false
38
- - id: cargo-fmt
39
- name: cargo fmt
40
- entry: cargo fmt --
41
- language: system
42
- types: [rust]
43
- pass_filenames: false
44
- - id: clippy-fix
45
- name: cargo clippy --fix
46
- entry: cargo clippy --fix --allow-dirty --allow-staged
47
- language: system
48
- types: [rust]
49
- pass_filenames: false
50
- require_serial: true
51
- - id: clippy-enforce
52
- name: cargo clippy (enforce warnings)
53
- entry: cargo clippy --all-targets --all-features -- -D warnings
54
- language: system
55
- types: [rust]
56
- pass_filenames: false
57
- require_serial: true
58
- - repo: https://github.com/rvben/rumdl-pre-commit
59
- rev: v0.1.62
60
- hooks:
61
- - id: rumdl
62
- args: [--fix]
63
- - repo: https://github.com/charliermarsh/ruff-pre-commit
64
- rev: v0.15.8
65
- hooks:
66
- - id: ruff-check
67
- args: [--fix, --exit-non-zero-on-fix, --show-fixes]
68
- types_or: [python, pyi, jupyter]
69
- - id: ruff-format
70
- types_or: [python, pyi, jupyter]
71
- - repo: https://github.com/owenlamont/ryl-pre-commit
72
- rev: v0.4.1
73
- hooks:
74
- - id: ryl
75
- - repo: https://github.com/adhtruong/mirrors-typos
76
- rev: v1.44.0
77
- hooks:
78
- - id: typos
79
- args: [
80
- --force-exclude,
81
- # --write-changes (Don't use this to stop typos making auto-corrections)
82
- ]
83
- - repo: https://github.com/woodruffw/zizmor-pre-commit
84
- rev: v1.23.1
85
- hooks:
86
- - id: zizmor
87
- args: [ --min-severity, low, --min-confidence, medium, --fix=safe]
package/.yamllint DELETED
@@ -1,4 +0,0 @@
1
- extends: relaxed
2
-
3
- rules:
4
- line-length: disable
package/AGENTS.md DELETED
@@ -1,200 +0,0 @@
1
- # Coding Agent Instructions
2
-
3
- Guidance on how to navigate and modify this codebase.
4
-
5
- ## What This Tool Does
6
-
7
- ryl is a CLI tool for linting yaml files
8
-
9
- ## Project Structure
10
-
11
- - **/src/** – All application code lives here.
12
- - **/tests/** – Unit and integration tests.
13
- - **pyproject.toml** - Package configuration
14
- - **.pre-commit-config.yaml** - Prek managed linters and some configuration
15
-
16
- ## Coding Standards
17
-
18
- - Code maintainability is the top priority - ideally a new agent can be onboarded onto
19
- using this repo and able to get all the necessary context from the documentation and
20
- code with no surprising behaviour or pitfalls (this is the pit of success principle -
21
- the most likely way to do something is also the correct way).
22
- - In relation to maintainability / readability keep the code as succinct as practical.
23
- Every line of code has a maintenance and read time cost (so try to keep code readable
24
- with good naming of files, functions, structures, and variable instead of using
25
- comments). Remember every new conditional added has a significant testing burden as it
26
- will likely require a new test to be added and maintained. We want to keep code bloat
27
- to a minimum and the best refactors generally are those that remove lines of code
28
- while maintaining functionality.
29
- - Comments should only be used to explain unavoidable code smells (arising from third
30
- party crate use), or the reason for temporary dependency version pinning (e.g.
31
- linking an unresolved GitHub issues) or lastly explaining opaque code or non-obvious
32
- trade-offs or workarounds.
33
- - Leverage the provided linters and formatters to fix code, configuration, and
34
- documentation often - it's much cheaper to have the linters and formatters auto fix
35
- issues than correcting them yourself. Only correct what the linters and formatters
36
- can't automatically fix.
37
- - No unsafe Rust code. Do not introduce `unsafe` in application code or tests. If a
38
- change appears to require `unsafe`, propose an alternative design that keeps code
39
- safe. The crate is built with `#![forbid(unsafe_code)]` and tests should follow the
40
- same principle.
41
- - Remember the linter/formatter prek won't scan any new modules until they are added to
42
- git so don't forget to git add any new modules you create before running prek.
43
- - Use the most modern Rust idioms and syntax allowed by the Rust version (currently this
44
- is Rust 1.93.1).
45
- - Keep `clippy.toml` `msrv` in sync with `rust-toolchain.toml` whenever the Rust
46
- toolchain channel is changed.
47
- - Don't rely on your memory of libraries and APIs. All external dependencies evolve fast
48
- so ensure current documentation and/or repo is consulted when working with third party
49
- dependencies.
50
- - When mirroring yamllint behaviour, spot-check tricky inputs with the yamllint CLI so
51
- our diagnostics and message text match (e.g., mixed newline styles or config keys of
52
- type int/bool/null/tagged scalar).
53
-
54
- ## Code Change Requirements
55
-
56
- - Whenever any files are edited ensure all prek linters pass (run:
57
- `prek run --all-files`).
58
- - `prek` already runs the key tooling (e.g., trim/fix whitespace, `cargo fmt`,
59
- `cargo clippy --fix`, `cargo clippy`, `rumdl` for Markdown/docs, etc.), so skip
60
- invoking those individually—just run `prek` once after code *or* docs updates.
61
- - Whenever source files are edited ensure the full test suite passes (run
62
- `./scripts/coverage-missing.sh` (Unix) or
63
- `pwsh ./scripts/coverage-missing.ps1` (Windows) to regenerate coverage; it reports
64
- uncovered ranges and confirms when coverage is complete)
65
- - For any behaviour or feature changes ensure all documentation is updated
66
- appropriately.
67
-
68
- ## Development Environment / Terminal
69
-
70
- - This repo runs on Mac, Linux, and Windows. Don't make assumptions about the shell
71
- you're running on without checking first (it could be a Posix shell like Bash or
72
- Windows Powershell).
73
- - `prek`, `rg`, `rumdl`, `typos`, `yamllint`, and `zizmor` should be installed as global
74
- tools (if they don't appear to be installed raise that with the user).
75
- - `gh` will be available in most, but not all environments to inspect GitHub.
76
- - When reviewing PR feedback, prefer `gh pr view <number> --json comments,reviews` for
77
- summary threads and `gh api repos/<owner>/<repo>/pulls/<number>/comments` when you
78
- need inline review details without guesswork. Avoid flags that the GitHub CLI does not
79
- support (e.g., `--review-comments`).
80
- - Linters and tests may write outside the workspace (e.g., `~/.cache/prek`). If
81
- sandboxed, request permission escalation when running `prek`, `cargo test`,
82
- or coverage commands.
83
- - Allow at least a 1-minute timeout per linter/test invocation; increase as
84
- needed for larger runs or CI.
85
-
86
- ## Automated Tests
87
-
88
- - Don't use comments in tests, use meaningful function names, and variable names to
89
- convey the test purpose.
90
- - Every line of code has a maintenance cost, so don't add tests that don't meaningfully
91
- increase code coverage. Aim for full branch coverage but also minimise the tests code
92
- lines to src code lines ratio.
93
- - Do not add `#[cfg(test)]` test modules directly inside files under `src/`. Unit tests
94
- compiled alongside the library create duplicate LLVM coverage instantiations and break
95
- the "zero missed regions" guarantee enforced by CI. Add new coverage via CLI/system
96
- tests in `tests/` instead.
97
-
98
- ## Coverage Workflow
99
-
100
- The CI enforces zero missed lines and zero missed regions. Use this workflow instead of
101
- hunting through scattered tips:
102
-
103
- 1. Quick status before pushing: run `./scripts/coverage-missing.sh` (Unix) or
104
- `pwsh ./scripts/coverage-missing.ps1` (Windows). It reruns the coverage suite and
105
- prints any uncovered ranges, or explicitly confirms when coverage is complete.
106
- 2. If the script reports files, extend CLI/system tests targeting those ranges until
107
- the script produces no output.
108
- 3. For richer artifacts (HTML, LCOV, etc.), follow the cargo-llvm-cov documentation
109
- after running the script. HTML is not easily machine readable though so not
110
- recommended.
111
- 4. When coverage points to tricky regions, prefer CLI/system tests in `tests/`
112
- that drive `env!("CARGO_BIN_EXE_ryl")` so you exercise the same paths as users.
113
- 5. When you need to observe the exact flow through an uncovered branch, run the
114
- failing test under `rust-lldb` (ships with the toolchain). Start with
115
- `cargo test --no-run` and then
116
- `rust-lldb target/debug/deps/<test-binary> -- <filter args>` to set breakpoints
117
- on the problematic lines.
118
- 6. If cached coverage lingers, clear `target/llvm-cov-target` and rerun.
119
-
120
- ### Coverage-Friendly Rust Idioms
121
-
122
- - Guard invariants with `expect` (or an early `return Err(...)`) when the
123
- “else” branch is truly unreachable. Leaving a `return` in the unreachable path
124
- often shows up as a permanent uncovered region even though the condition is
125
- ruled out. Reserve `assert!` for test-only code or cases where a runtime panic
126
- is acceptable.
127
- - When walking indices backwards, call `checked_sub(1).expect("…")` instead of
128
- matching on `checked_sub`; the `expect` documents the invariant and removes
129
- the uncovered `None` branch that instrumentation reports.
130
- - When collecting spans, store the raw tuple `(start, end)` and filter once at
131
- the end instead of pushing `Range` conditionally; this keeps the guard logic
132
- centralized and ensures LLVM records the conversion branch exactly once.
133
- - Normalize prefix checks with `strip_prefix(...).expect(...)` when downstream
134
- code already guarantees the prefix; this removes the otherwise uncovered
135
- `return` path that instrumentation would highlight.
136
-
137
- Windows/MSVC: ensure the `llvm-tools-preview` component is installed (already listed in
138
- `rust-toolchain.toml`). Run from a Developer Command Prompt if linker tools go missing.
139
-
140
- ### Common hotspots
141
-
142
- - Configuration discovery: use the `Env` abstraction (`discover_config_with`) and fake
143
- envs to hit inline data, explicit files (success and YAML failure), and env-var paths.
144
- - Project configuration search: cover empty inputs, single files without parents, and
145
- multiple files in the same directory to trigger dedup logic.
146
- - YAML parsing: drive `from_yaml_str` through string vs sequence options and ensure rule
147
- merges hit both update and insert branches.
148
- - CLI context resolution: pass an empty `PathBuf` into `resolve_ctx` to trigger the
149
- fallback to `.`.
150
- - Flow scanners in rules: always reconcile parser byte spans with `char_indices()` via
151
- `crate::rules::span_utils` to avoid off-by-byte bugs when UTF-8 characters appear.
152
-
153
- CI will fail the build on any missed line or region, so keep local runs green by
154
- sticking to the quick-status step above.
155
-
156
- ## Testing Tips
157
-
158
- - For Unicode-heavy fixtures, assert behaviour with multibyte characters and reuse the
159
- helpers in `crate::rules::span_utils` instead of reinventing byte/char conversions.
160
- When writing tests, prefer inputs like `"café"` or `"å"` to ensure coverage of
161
- character vs byte offset logic.
162
- - Use meaningful function and variable names in tests—comments are discouraged.
163
- - `#[cfg(test)]` modules inside `src/` is forbidden; add coverage through integration
164
- tests in `tests/` so LLVM regions stay unique.
165
-
166
- ## Release Checklist
167
-
168
- - Bump versions in lockstep:
169
- - Cargo: update `Cargo.toml` `version`.
170
- - Python: update `pyproject.toml` `[project].version`.
171
- - Refresh lockfile and validate:
172
- - Run `cargo generate-lockfile` (or `cargo check`) to refresh `Cargo.lock`.
173
- - Stage: `git add Cargo.toml Cargo.lock pyproject.toml`.
174
- - Run `prek run --all-files` (re-run if files were auto-fixed).
175
- - Docs and notes:
176
- - Update README/AGENTS for behavior changes.
177
- - Summarize notable changes in the PR description or changelog (if present).
178
- - Tag and push (when releasing):
179
- - `git tag -a vX.Y.Z -m "vX.Y.Z"`
180
- - `git push && git push --tags`
181
- - `.github/workflows/release.yml` validates that the pushed tag version
182
- matches both `Cargo.toml` and `pyproject.toml` versions before release jobs run.
183
- - Publishing uses Trusted Publishing for both registries:
184
- - crates.io via GitHub OIDC (`rust-lang/crates-io-auth-action`)
185
- - PyPI via Trusted Publishing (`pypa/gh-action-pypi-publish`)
186
- - GitHub release creation is deferred until the end of the workflow, after
187
- crates.io and PyPI publishing succeed.
188
- - GitHub release notes are generated automatically by GitHub when the release
189
- draft is created.
190
- - The workflow keeps GitHub releases as drafts until assets are uploaded and
191
- supports reruns by skipping crates.io/PyPI publish steps when that exact
192
- version already exists.
193
-
194
- ## CLI Behavior
195
-
196
- - Accepts one or more inputs: files and/or directories.
197
- - Directories: recursively scan `.yml`/`.yaml` files, honoring git ignore and
198
- git exclude; does not follow symlinks.
199
- - Files: parsed as YAML even if the extension is not `.yml`/`.yaml`.
200
- - Exit codes: `0` (ok/none), `1` (invalid YAML), `2` (usage error).