From 8b38cf7b89169cfeaaac4fc6aa40c99b3e394c7e Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Sun, 1 Nov 2026 20:28:32 +0100 Subject: [PATCH] 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> --- AGENTS.md | 20 ++++++++++++++------ Cargo.toml | 3 ++- README.md | 20 ++++++++++++++++++++ clippy.toml | 1 + crates/runa/Cargo.toml | 2 +- mise.toml | 18 ++++++++++++++++++ rustfmt.toml | 2 ++ tombi.toml | 9 +++++++++ 8 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 clippy.toml create mode 100644 mise.toml create mode 100644 rustfmt.toml create mode 100644 tombi.toml diff --git a/AGENTS.md b/AGENTS.md index 6b60427..dd898fe 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -45,12 +45,16 @@ proposed capabilities as plans, not existing behavior. Run these from the repository root: ```sh -cargo fmt --all -- --check -cargo check --workspace -cargo clippy --workspace --all-targets -- -D warnings -cargo test --workspace +mise run format +mise run lint +mise run test +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. ## 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. - Check the current branch before committing. Use conventional commit messages and include the repository's configured Copilot co-author trailer. -- Run relevant formatting, build, lint, and test checks before committing code - changes. Documentation-only changes do not require code checks. +- Before every commit, including documentation-only commits, run + `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. diff --git a/Cargo.toml b/Cargo.toml index 9440be0..7c6228c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] resolver = "3" members = [ - "crates/runa", "crates/runa-rune", + "crates/runa", + "crates/runa-rune", ] diff --git a/README.md b/README.md index d7ff4ac..efaefca 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,26 @@ cargo run -p runa 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 ```text diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..19501c1 --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +doc-valid-idents = ["..", "Runa", "Rune"] diff --git a/crates/runa/Cargo.toml b/crates/runa/Cargo.toml index 4575898..0db6b02 100644 --- a/crates/runa/Cargo.toml +++ b/crates/runa/Cargo.toml @@ -3,4 +3,4 @@ name = "runa" version = "0.0.0" edition = "2024" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..8a3ab38 --- /dev/null +++ b/mise.toml @@ -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" }] diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..f3e454b --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2024" +style_edition = "2024" diff --git a/tombi.toml b/tombi.toml new file mode 100644 index 0000000..df70164 --- /dev/null +++ b/tombi.toml @@ -0,0 +1,9 @@ +[files] +include = ["**/*.toml"] +exclude = ["target/**"] + +[format.rules] +indent-style = "space" +indent-width = 4 +line-ending = "lf" +line-width = 100