53 lines
1.6 KiB
Markdown
53 lines
1.6 KiB
Markdown
---
|
|
description: Review changes against repository style rules
|
|
argument-hint: "[target]"
|
|
---
|
|
|
|
Review target: `${ARGUMENTS:-the staged diff}`.
|
|
Audit the target for violations of the repository style rules.
|
|
|
|
Choose skills from the reviewed files:
|
|
|
|
- Use the `nix-style` skill for `*.nix` files.
|
|
- Use the `rust-style` skill for `*.rs` files.
|
|
- Use the `build-style` skill for `Cargo.toml` files.
|
|
- Use the `build-style` skill for Bazel `BUILD` files.
|
|
|
|
If the target includes multiple matching file types, use all matching skills.
|
|
If the target is a diff, choose skills from the changed files.
|
|
Do not use a style skill when no reviewed file matches it.
|
|
|
|
For every reviewed `*.nix` file, run:
|
|
|
|
```bash
|
|
bazel run //src/natu:natu -- <reviewed-nix-paths>
|
|
```
|
|
|
|
Pass every reviewed Nix path to Natu.
|
|
Report every Natu diagnostic as an actionable finding.
|
|
|
|
Report only actionable findings.
|
|
Order findings by severity.
|
|
Do not report preferences unless a loaded rule states them.
|
|
|
|
Use this format for each finding:
|
|
|
|
```text
|
|
`code-path:line`
|
|
> `smallest reviewed-code excerpt that shows the violation`
|
|
|
|
`skill::rule-file:line`: Finding title.
|
|
Summary: why the code breaks the rule
|
|
Fix: suggested fix
|
|
```
|
|
|
|
Keep the code excerpt to one to three lines when possible.
|
|
Use a longer excerpt only when the violation needs surrounding context.
|
|
Use `...` to omit unrelated lines from a multi-line excerpt.
|
|
Use a style-skill rule citation in the form `skill::rule-file:line`.
|
|
Cite Natu diagnostics as `natu::<rule-id>`.
|
|
Make the fix direct.
|
|
Do not include alternatives when one fix best follows the cited rule.
|
|
|
|
It is acceptable to report no findings when the target follows the loaded rules.
|