Skip to content

Commit 434de60

Browse files
style: pre-commit fixes
1 parent 3e281f1 commit 434de60

24 files changed

Lines changed: 495 additions & 621 deletions

AGENTS.md

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Agent Guide for scientific-python/cookie
22

3-
This repo has three distinct concerns: a **cookiecutter/copier template** for new Python projects (`{{cookiecutter.project_name}}/`), a **repo-review plugin** (`src/sp_repo_review/`), and a **Jekyll-based developer guide** (`docs/`).
3+
This repo has three distinct concerns: a **cookiecutter/copier template** for
4+
new Python projects (`{{cookiecutter.project_name}}/`), a **repo-review plugin**
5+
(`src/sp_repo_review/`), and a **Jekyll-based developer guide** (`docs/`).
46

57
## Key commands
68

@@ -17,41 +19,58 @@ Important: tests run with `PYTHONWARNDEFAULTENCODING=1`.
1719

1820
### Cookie template validation
1921

20-
The noxfile generates temporary projects for **all 9 backends** × **vcs on/off** × **3 docs engines** (sphinx/mkdocs/zensical). These are slow.
22+
The noxfile generates temporary projects for **all 9 backends** × **vcs on/off**
23+
× **3 docs engines** (sphinx/mkdocs/zensical). These are slow.
2124

2225
- `nox -s "tests(hatch)"` — run generated project tests for a single backend
2326
- `nox -s "lint(hatch)"` — run pre-commit (`prek`) on generated project
2427
- `nox -s "dist(hatch)"` — verify build output includes LICENSE
2528
- `nox -s "native(hatch)"` — test hatch/pdm/poetry native test runners
26-
- `nox -s compare_copier` — verify cookiecutter and copier produce identical files
29+
- `nox -s compare_copier` — verify cookiecutter and copier produce identical
30+
files
2731
- `nox -s compare_cruft` — verify cookiecutter and cruft produce identical files
2832
- `nox -s gha_bump` — bump GitHub Actions versions across docs and templates
2933
- `nox -s pc_bump` — bump pre-commit hook versions across docs and templates
3034

3135
## Architecture notes
3236

33-
- **Template directory**: `{{cookiecutter.project_name}}/` contains the cookiecuttter template. Copier reads `copier.yml`; cookiecutter reads `cookiecutter.json`. Keep them in sync; `compare_copier` checks this.
34-
- **Entry points**: `sp_repo_review` registers `repo-review` checks/families/fixtures via `[project.entry-points]` in `pyproject.toml`.
35-
- **Generated docs**: The README check list (line ~300+) is a cog block. Do not edit it by hand; run `nox -s readme` or cog will fail in CI.
36-
- **Cookie template `.pre-commit-config.yaml`** uses `prek` (a Rust-based pre-commit alternative), not `pre-commit`.
37-
- **Ruff hook ID**: `.pre-commit-config.yaml` uses `ruff-check` as the hook id (not `ruff`), for pre-commit 4.x compatibility.
37+
- **Template directory**: `{{cookiecutter.project_name}}/` contains the
38+
cookiecuttter template. Copier reads `copier.yml`; cookiecutter reads
39+
`cookiecutter.json`. Keep them in sync; `compare_copier` checks this.
40+
- **Entry points**: `sp_repo_review` registers `repo-review`
41+
checks/families/fixtures via `[project.entry-points]` in `pyproject.toml`.
42+
- **Generated docs**: The README check list (line ~300+) is a cog block. Do not
43+
edit it by hand; run `nox -s readme` or cog will fail in CI.
44+
- **Cookie template `.pre-commit-config.yaml`** uses `prek` (a Rust-based
45+
pre-commit alternative), not `pre-commit`.
46+
- **Ruff hook ID**: `.pre-commit-config.yaml` uses `ruff-check` as the hook id
47+
(not `ruff`), for pre-commit 4.x compatibility.
3848

3949
## Style and conventions
4050

41-
- `tool.pytest.ini_options.norecursedirs` excludes `{{cookiecutter.project_name}}` so pytest does not descend into the template directory.
42-
- `tool.ruff.extend-exclude` also excludes `\{\{cookiecutter.project_name\}\}` (double-escaped in TOML).
43-
- `tool.mypy.python_version = "3.10"`; the `sp_repo_review.*` override enforces `disallow_untyped_defs=True`.
44-
- `tool.pylint.master.ignore-paths` ignores `src/sp_repo_review/_version.py` (auto-generated by hatch-vcs).
45-
- Ruff selects `ALL` with many ignores; notable: `S101` (assert) and `D` (docstrings) are globally disabled.
51+
- `tool.pytest.ini_options.norecursedirs` excludes
52+
`{{cookiecutter.project_name}}` so pytest does not descend into the template
53+
directory.
54+
- `tool.ruff.extend-exclude` also excludes `\{\{cookiecutter.project_name\}\}`
55+
(double-escaped in TOML).
56+
- `tool.mypy.python_version = "3.10"`; the `sp_repo_review.*` override enforces
57+
`disallow_untyped_defs=True`.
58+
- `tool.pylint.master.ignore-paths` ignores `src/sp_repo_review/_version.py`
59+
(auto-generated by hatch-vcs).
60+
- Ruff selects `ALL` with many ignores; notable: `S101` (assert) and `D`
61+
(docstrings) are globally disabled.
4662

4763
## CI quirks
4864

49-
- CI uses change detection to decide whether to run cookie tests or rr-tests. Both are required to pass for the `pass` job.
65+
- CI uses change detection to decide whether to run cookie tests or rr-tests.
66+
Both are required to pass for the `pass` job.
5067
- rr-tests matrix runs on Python 3.10, 3.12, 3.14 across ubuntu/macos/windows.
5168
- Cookie tests reuse the same `reusable-cookie.yml` workflow.
5269

5370
## Docs site (Jekyll)
5471

55-
- Ruby-based; uses `rbenv` + `bundle install` + `bundle exec jekyll serve --livereload`.
72+
- Ruby-based; uses `rbenv` + `bundle install` +
73+
`bundle exec jekyll serve --livereload`.
5674
- There is a helper script `helpers/fetch_repo_review_app.sh`.
57-
- Docs pages in `docs/pages/` contain inline cog blocks that auto-generate config examples from the template.
75+
- Docs pages in `docs/pages/` contain inline cog blocks that auto-generate
76+
config examples from the template.

docs/pages/guides/coverage.md

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@ Tools and libraries used to calculate, read, and visualize coverage reports:
2121
- `GitHub Actions`: allows users to automatically upload coverage reports to
2222
`Codecov`
2323

24-
:::{note} Are there any alternatives?
25-
Coveralls is an alternative coverage platform, but we recommend using Codecov
26-
because of its ease of use and integration with GitHub Actions.
27-
:::
24+
:::{note} Are there any alternatives? Coveralls is an alternative coverage
25+
platform, but we recommend using Codecov because of its ease of use and
26+
integration with GitHub Actions. :::
2827

29-
:::{tip} Should increasing the coverage value be my top priority?
30-
A low coverage percentage will definitely motivate you to add more tests, but
31-
adding weak tests just for coverage's sake is not a good idea. The tests
32-
should test your codebase thoroughly and should not be unreliable.
33-
:::
28+
:::{tip} Should increasing the coverage value be my top priority? A low coverage
29+
percentage will definitely motivate you to add more tests, but adding weak tests
30+
just for coverage's sake is not a good idea. The tests should test your codebase
31+
thoroughly and should not be unreliable. :::
3432

3533
### Running your tests with coverage
3634

@@ -43,10 +41,8 @@ directly is hidden away from normal use, so we recommend that, but will show
4341
both methods below. If you are not running `pytest`, but instead are running an
4442
example or a script, you have to use `coverage` directly.
4543

46-
::::{tab-set}
47-
:::{tab-item} coverage
48-
:sync: coverage-tool
49-
Make sure you install `coverage[toml]`.
44+
::::{tab-set} :::{tab-item} coverage :sync: coverage-tool Make sure you install
45+
`coverage[toml]`.
5046

5147
`coverage` has several commands; the most important one is `coverage run`. This
5248
will run any Python process and collect coverage, generating a `.coverage` file
@@ -65,11 +61,8 @@ coverage report
6561
```
6662

6763
This looks for a `.coverage` file and displays the result. There are many output
68-
formats for reports.
69-
:::
70-
:::{tab-item} pytest-cov
71-
:sync: coverage-tool
72-
Make sure you install `pytest-cov`.
64+
formats for reports. ::: :::{tab-item} pytest-cov :sync: coverage-tool Make sure
65+
you install `pytest-cov`.
7366

7467
`pytest` allows users to pass the `--cov` option to automatically invoke
7568
`pytest-cov`, which then generates a `.coverage` file with the calculated
@@ -88,9 +81,7 @@ See the [docs](https://pytest-cov.readthedocs.io/en/latest/) for more options.
8881

8982
Coverage pytest arguments can be placed in your pytest configuration file or in
9083
your task runner. It also will (mostly) respect the coverage configuration,
91-
shown below.
92-
:::
93-
::::
84+
shown below. ::: ::::
9485

9586
### Configuring coverage
9687

@@ -149,9 +140,8 @@ manually produce multiple files from task runner jobs.
149140

150141
Here's an example nox job:
151142

152-
::::{tab-set}
153-
:::{tab-item} coverage
154-
:sync: coverage-tool
143+
::::{tab-set} :::{tab-item} coverage :sync: coverage-tool
144+
155145
```python
156146
session.run(
157147
"coverage",
@@ -162,18 +152,18 @@ Here's an example nox job:
162152
env={"COVERAGE_FILE": coverage_file},
163153
)
164154
```
165-
:::
166-
:::{tab-item} pytest-cov
167-
:sync: coverage-tool
155+
156+
::: :::{tab-item} pytest-cov :sync: coverage-tool
157+
168158
```python
169159
"--cov=<package_name>",
170160
"--cov-config=pyproject.toml",
171161
*session.posargs,
172162
env={"COVERAGE_FILE": coverage_file},
173163
)
174164
```
175-
:::
176-
::::
165+
166+
::: ::::
177167

178168
#### Merging and reporting
179169

@@ -207,7 +197,6 @@ uploading coverage reports easy for users. A minimal working example for
207197
uploading coverage reports through your workflow, which should be more than
208198
enough for a simple testing suite, can be written as follows:
209199

210-
211200
```yaml
212201
- name: Upload coverage report
213202
uses: codecov/codecov-action@v6

0 commit comments

Comments
 (0)