chore: configure mise pre-commit checks
Add formatting, lint, and test tasks with Tombi, rustfmt, and Clippy configuration. Require agents to pass the pre-commit task before committing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
50bc795738
commit
8b38cf7b89
20
AGENTS.md
20
AGENTS.md
|
|
@ -45,12 +45,16 @@ proposed capabilities as plans, not existing behavior.
|
||||||
Run these from the repository root:
|
Run these from the repository root:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cargo fmt --all -- --check
|
mise run format
|
||||||
cargo check --workspace
|
mise run lint
|
||||||
cargo clippy --workspace --all-targets -- -D warnings
|
mise run test
|
||||||
cargo test --workspace
|
mise run pre-commit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`mise run pre-commit` runs format, lint, and test sequentially, stopping on
|
||||||
|
failure. Formatting uses the repository's Tombi and rustfmt configurations.
|
||||||
|
Clippy checks all workspace targets and treats warnings as errors.
|
||||||
|
|
||||||
The current project is a minimal executable and may not yet have tests.
|
The current project is a minimal executable and may not yet have tests.
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
@ -63,5 +67,9 @@ The current project is a minimal executable and may not yet have tests.
|
||||||
- Do not push changes unless explicitly asked.
|
- Do not push changes unless explicitly asked.
|
||||||
- Check the current branch before committing. Use conventional commit messages
|
- Check the current branch before committing. Use conventional commit messages
|
||||||
and include the repository's configured Copilot co-author trailer.
|
and include the repository's configured Copilot co-author trailer.
|
||||||
- Run relevant formatting, build, lint, and test checks before committing code
|
- Before every commit, including documentation-only commits, run
|
||||||
changes. Documentation-only changes do not require code checks.
|
`mise run pre-commit` and require a successful exit. Fix all reported
|
||||||
|
formatting, lint, and test problems, then rerun the task until it passes.
|
||||||
|
Do not bypass checks or suppress diagnostics merely to make a commit pass.
|
||||||
|
- Review and stage formatter changes before committing. If further changes
|
||||||
|
are made after validation, rerun `mise run pre-commit` before committing.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = [
|
members = [
|
||||||
"crates/runa", "crates/runa-rune",
|
"crates/runa",
|
||||||
|
"crates/runa-rune",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
20
README.md
20
README.md
|
|
@ -41,6 +41,26 @@ cargo run -p runa
|
||||||
|
|
||||||
At this stage, it prints `Hello, world!`.
|
At this stage, it prints `Hello, world!`.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Install [mise](https://mise.jdx.dev/) and run `mise install` to install Tombi.
|
||||||
|
Rust, rustfmt, and Clippy must also be available on your PATH.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mise run format
|
||||||
|
mise run lint
|
||||||
|
mise run test
|
||||||
|
mise run pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
The pre-commit task runs formatting, linting, and tests in that order, stopping
|
||||||
|
on the first failure. Run it successfully before committing and review any
|
||||||
|
formatter changes. This is a task, not an automatically installed Git hook.
|
||||||
|
|
||||||
|
Tombi formats TOML files offline; rustfmt formats all workspace Rust code.
|
||||||
|
Clippy checks all workspace targets with warnings treated as errors, and the
|
||||||
|
test task runs `cargo test --workspace`.
|
||||||
|
|
||||||
## Project structure
|
## Project structure
|
||||||
|
|
||||||
```text
|
```text
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
doc-valid-idents = ["..", "Runa", "Rune"]
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
[tools]
|
||||||
|
tombi = "latest"
|
||||||
|
|
||||||
|
[tasks.format]
|
||||||
|
description = "Format TOML and Rust files"
|
||||||
|
run = ["tombi format --offline", "cargo fmt --all"]
|
||||||
|
|
||||||
|
[tasks.test]
|
||||||
|
description = "Run workspace tests"
|
||||||
|
run = "cargo test --workspace"
|
||||||
|
|
||||||
|
[tasks.lint]
|
||||||
|
description = "Lint all workspace targets with Clippy"
|
||||||
|
run = "cargo clippy --workspace --all-targets -- -D warnings"
|
||||||
|
|
||||||
|
[tasks.pre-commit]
|
||||||
|
description = "Format, lint, and test before committing"
|
||||||
|
run = [{ task = "format" }, { task = "lint" }, { task = "test" }]
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
edition = "2024"
|
||||||
|
style_edition = "2024"
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
[files]
|
||||||
|
include = ["**/*.toml"]
|
||||||
|
exclude = ["target/**"]
|
||||||
|
|
||||||
|
[format.rules]
|
||||||
|
indent-style = "space"
|
||||||
|
indent-width = 4
|
||||||
|
line-ending = "lf"
|
||||||
|
line-width = 100
|
||||||
Loading…
Reference in New Issue