From 239b5198e4d628a0e5b8b1653b92ba1403058dd4 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Tue, 29 Sep 2026 12:53:29 +0200 Subject: [PATCH] test: enforce coverage and publish badges --- .gitignore | 3 +++ .run_status.toml | 8 ++++++++ AGENTS.md | 6 ++++++ Jenkinsfile | 24 ++++++++++++++++++++++-- README.md | 4 ++++ badges/coverage.svg | 1 + badges/test.svg | 1 + badges/version.svg | 1 + tarpaulin.toml | 13 +++++++++++++ tasks.md | 2 +- 10 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 .run_status.toml create mode 100644 badges/coverage.svg create mode 100644 badges/test.svg create mode 100644 badges/version.svg create mode 100644 tarpaulin.toml diff --git a/.gitignore b/.gitignore index 27cdb5a..fbdab61 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ target/ # Local implementation journal (intentionally not committed) /recap.md + +# Generated locally by rust_autobadges/Cargo Tarpaulin +/tarpaulin-report.html diff --git a/.run_status.toml b/.run_status.toml new file mode 100644 index 0000000..b64add1 --- /dev/null +++ b/.run_status.toml @@ -0,0 +1,8 @@ +[last_run_clean] +run_status = "Success" +lines_parsed = 114 +coverage = 72.32 + +[last_run_clean.run_duration] +secs = 10 +nanos = 643158348 diff --git a/AGENTS.md b/AGENTS.md index 6d1600b..986b7d8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -219,9 +219,15 @@ Before considering a task complete, run: cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo test --all-targets --all-features +cargo test --all-targets --no-default-features cargo doc --no-deps ``` +Run `cargo tarpaulin --config tarpaulin.toml` when tests or executable Rust code +change. It enforces the intentionally modest 30% line-coverage floor. Refresh +the tracked local badges with `rust_autobadges --high-coverage-percent 0.7 +--mid-coverage-percent 0.3` after a clean test and coverage run. + Also run focused CLI golden tests and LSP protocol tests once those binaries exist. Favor property tests for replacement idempotence/non-overlap and fuzz targets for config parsing, span conversion, archives, and replacement planning. diff --git a/Jenkinsfile b/Jenkinsfile index 3f0f16f..1dce2db 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,7 @@ pipeline { CARGO_TERM_COLOR = 'always' RUST_BACKTRACE = '1' MSRV = '1.98.1' + TARPAULIN_VERSION = '0.37.4' } stages { @@ -52,6 +53,13 @@ pipeline { cargo --version rustfmt --version cargo clippy --version + + INSTALLED_TARPAULIN="$(cargo tarpaulin --version 2>/dev/null || true)" + if [ "${INSTALLED_TARPAULIN}" != "cargo-tarpaulin-tarpaulin ${TARPAULIN_VERSION}" ]; then + cargo install cargo-tarpaulin \ + --locked \ + --version "${TARPAULIN_VERSION}" + fi ''' } } @@ -128,6 +136,18 @@ pipeline { } } + stage('Coverage') { + steps { + sh ''' + set -eu + + echo "Measuring line coverage..." + + cargo tarpaulin --config tarpaulin.toml + ''' + } + } + stage('Clippy') { steps { sh ''' @@ -173,7 +193,7 @@ pipeline { conclusion: 'SUCCESS', name: 'Rust CI', summary: 'JohnSlop passed all CI checks.', - text: 'Formatting, compilation checks, tests, Clippy, and the release build completed successfully.', + text: 'Formatting, compilation checks, feature tests, coverage, Clippy, and the release build completed successfully.', title: 'Build Successful' ) @@ -185,7 +205,7 @@ pipeline { conclusion: 'FAILURE', name: 'Rust CI', summary: 'JohnSlop failed CI.', - text: 'Formatting, compilation, tests, Clippy, or the release build failed. Check the Jenkins log.', + text: 'Formatting, compilation, tests, coverage, Clippy, or the release build failed. Check the Jenkins log.', title: 'Build Failed' ) diff --git a/README.md b/README.md index 892b7d1..913364d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # John Slop +![version](badges/version.svg) +![tests](badges/test.svg) +![test coverage](badges/coverage.svg) + John Slop is an early-stage, local-first heuristic linter for concrete signals of low-effort or insufficiently reviewed text and source code. It is intended to highlight evidence for human review, not to prove that content was written by AI diff --git a/badges/coverage.svg b/badges/coverage.svg new file mode 100644 index 0000000..d8efb10 --- /dev/null +++ b/badges/coverage.svg @@ -0,0 +1 @@ +test-coverage: 72%test-coverage72% \ No newline at end of file diff --git a/badges/test.svg b/badges/test.svg new file mode 100644 index 0000000..382bf2f --- /dev/null +++ b/badges/test.svg @@ -0,0 +1 @@ +test: passingtestpassing \ No newline at end of file diff --git a/badges/version.svg b/badges/version.svg new file mode 100644 index 0000000..3384e6c --- /dev/null +++ b/badges/version.svg @@ -0,0 +1 @@ +version: 0.1.0version0.1.0 \ No newline at end of file diff --git a/tarpaulin.toml b/tarpaulin.toml new file mode 100644 index 0000000..8f490ee --- /dev/null +++ b/tarpaulin.toml @@ -0,0 +1,13 @@ +[coverage] +all-features = true +engine = "Llvm" +fail-under = 30.0 +locked = true +run-types = ["Tests"] + +[report] +out = ["Stdout"] + +# CLI behavior is covered by subprocess integration tests. Tarpaulin may not +# attribute those child-process lines on every backend, so the enforced floor is +# intentionally modest and the badge reports the directly measured result. diff --git a/tasks.md b/tasks.md index 44ca037..03f5132 100644 --- a/tasks.md +++ b/tasks.md @@ -72,7 +72,7 @@ entry do not discard successful documents. stable releases; verify the locked graph with the declared toolchain. - [x] Add focused behavioral and snapshot tests, including feature-matrix coverage, without snapshotting structured domain values unnecessarily. -- [ ] Configure Tarpaulin with an enforceable coverage floor around 30%, run +- [x] Configure Tarpaulin with an enforceable coverage floor around 30%, run `rust_autobadges`, and publish local version/test/coverage badges. - [ ] Reduce the root README to a generic project landing page and move detailed usage, architecture, testing, coverage, and background links under `docs/`.