M0032 ci-workflow¶
Rule: The repo has a CI workflow and it runs the repo's checks.
| Code | M0032 (stable, never reused) |
| Id | ci-workflow |
| Category | repo |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | warn |
checks that only run on one PC get skipped; CI runs the repo's own checks on every push and pull request |
| medium | warn |
checks that only run on one PC get skipped; CI runs the repo's own checks on every push and pull request |
| big | warn |
checks that only run on one PC get skipped; CI runs the repo's own checks on every push and pull request |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
path |
string | ".github/workflows/ci.yml" |
the CI workflow, relative to the root |
Why¶
A check that only runs on one person's PC is skipped the day they are in a hurry. A CI workflow runs the same checks on every push and pull request, and its badge in the README shows whether main passes.
The workflow is read from the repo's own files (the parameter path, .github/workflows/ci.yml by default); what GitHub's settings do with it is not checked.
What counts as the repo's checks depends on the repo:
- With a justfile that has
lintandtestrecipes, arun:step callsjust lintand one callsjust test(or a variant such asjust test-all). CI then runs exactly what a person runs. Steps that run each command of a recipe as written count too: alintrecipe that is onlyspl checkis run by a stepspl check, with nojustto install. A recipe with{{...}}in its body, or a shebang recipe, needsjustitself. - Without them, a
run:step callscargo clippyand one callscargo testorcargo nextest.
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: just
- run: just lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: just,cargo-nextest
- run: just test
How to fix¶
Add the workflow, or the step the finding names, to one of its jobs. A workflow with another name sets the parameter path.
Configure¶
[lints.ci-workflow]
level = "deny"
path = ".github/workflows/ci.yml"
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(ci-workflow) <reason> (waivers); the code works there too, as in [lints.M0032].