Skip to content

Commit 61489a7

Browse files
authored
refactor: readthedocs rename (#706)
* refactor: rename docs -> rtd for check family Signed-off-by: Henry Schreiner <[email protected]> * fix: note when checks might be hidden Signed-off-by: Henry Schreiner <[email protected]> * Apply suggestions from code review --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 8952905 commit 61489a7

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ from repo_review.families import get_family_name
305305
collected = collect_all()
306306
print()
307307
for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1].family):
308-
print(f'### {get_family_name(collected.families, family)}')
308+
print(f'### {get_family_name(collected.families, family)}\n')
309+
if note := collected.families.get(family, {}).get("readme_note"):
310+
print(note, end="\n\n")
309311
for code, check in grp:
310312
url = get_check_url(code, check)
311313
link = f"[`{code}`]({url})" if url else f"`{code}`"
@@ -314,6 +316,7 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
314316
]]] -->
315317

316318
### General
319+
317320
- [`PY001`](https://learn.scientific-python.org/development/guides/packaging-simple#PY001): Has a pyproject.toml
318321
- [`PY002`](https://learn.scientific-python.org/development/guides/packaging-simple#PY002): Has a README.(md|rst) file
319322
- [`PY003`](https://learn.scientific-python.org/development/guides/packaging-simple#PY003): Has a LICENSE* file
@@ -323,6 +326,7 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
323326
- [`PY007`](https://learn.scientific-python.org/development/guides/tasks#PY007): Supports an easy task runner (nox, tox, pixi, etc.)
324327

325328
### PyProject
329+
326330
- [`PP002`](https://learn.scientific-python.org/development/guides/packaging-simple#PP002): Has a proper build-system table
327331
- [`PP003`](https://learn.scientific-python.org/development/guides/packaging-classic#PP003): Does not list wheel as a build-dep
328332
- [`PP004`](https://learn.scientific-python.org/development/guides/packaging-simple#PP004): Does not upper cap Python requires
@@ -338,14 +342,8 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
338342
- [`PP308`](https://learn.scientific-python.org/development/guides/pytest#PP308): Specifies useful pytest summary
339343
- [`PP309`](https://learn.scientific-python.org/development/guides/pytest#PP309): Filter warnings specified
340344

341-
### Documentation
342-
- [`RTD100`](https://learn.scientific-python.org/development/guides/docs#RTD100): Uses ReadTheDocs (pyproject config)
343-
- [`RTD101`](https://learn.scientific-python.org/development/guides/docs#RTD101): You have to set the RTD version number to 2
344-
- [`RTD102`](https://learn.scientific-python.org/development/guides/docs#RTD102): You have to set the RTD build image
345-
- [`RTD103`](https://learn.scientific-python.org/development/guides/docs#RTD103): You have to set the RTD python version
346-
- [`RTD104`](https://learn.scientific-python.org/development/guides/docs#RTD104): You have to specify a build configuration now for readthedocs.
347-
348345
### GitHub Actions
346+
349347
- [`GH100`](https://learn.scientific-python.org/development/guides/gha-basic#GH100): Has GitHub Actions config
350348
- [`GH101`](https://learn.scientific-python.org/development/guides/gha-basic#GH101): Has nice names
351349
- [`GH102`](https://learn.scientific-python.org/development/guides/gha-basic#GH102): Auto-cancel on repeated PRs
@@ -357,6 +355,7 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
357355
- [`GH212`](https://learn.scientific-python.org/development/guides/gha-basic#GH212): Require GHA update grouping
358356

359357
### MyPy
358+
360359
- [`MY100`](https://learn.scientific-python.org/development/guides/style#MY100): Uses MyPy (pyproject config)
361360
- [`MY101`](https://learn.scientific-python.org/development/guides/style#MY101): MyPy strict mode
362361
- `MY102`: MyPy show_error_codes deprecated
@@ -366,6 +365,9 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
366365
- [`MY106`](https://learn.scientific-python.org/development/guides/style#MY106): MyPy enables truthy-bool
367366

368367
### Nox
368+
369+
Will not show up if no `noxfile.py` file is present.
370+
369371
- [`NOX101`](https://learn.scientific-python.org/development/guides/tasks#NOX101): Sets minimum nox version
370372
- [`NOX102`](https://learn.scientific-python.org/development/guides/tasks#NOX102): Sets venv backend
371373
- [`NOX103`](https://learn.scientific-python.org/development/guides/tasks#NOX103): Set default per session instead of session list
@@ -374,6 +376,9 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
374376
- [`NOX203`](https://learn.scientific-python.org/development/guides/tasks#NOX203): Provide a main block to run nox
375377

376378
### Pre-commit
379+
380+
Will not show up if using lefthook instead of pre-commit/prek.
381+
377382
- [`PC100`](https://learn.scientific-python.org/development/guides/style#PC100): Has pre-commit-hooks
378383
- [`PC110`](https://learn.scientific-python.org/development/guides/style#PC110): Uses black or ruff-format
379384
- [`PC111`](https://learn.scientific-python.org/development/guides/style#PC111): Uses blacken-docs
@@ -388,7 +393,18 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
388393
- [`PC902`](https://learn.scientific-python.org/development/guides/style#PC902): Custom pre-commit CI autofix message
389394
- [`PC903`](https://learn.scientific-python.org/development/guides/style#PC903): Specified pre-commit CI schedule
390395

396+
### ReadTheDocs
397+
398+
Will not show up if no `.readthedocs.yml`/`.readthedocs.yaml` file is present.
399+
400+
- [`RTD100`](https://learn.scientific-python.org/development/guides/docs#RTD100): Uses ReadTheDocs (pyproject config)
401+
- [`RTD101`](https://learn.scientific-python.org/development/guides/docs#RTD101): You have to set the RTD version number to 2
402+
- [`RTD102`](https://learn.scientific-python.org/development/guides/docs#RTD102): You have to set the RTD build image
403+
- [`RTD103`](https://learn.scientific-python.org/development/guides/docs#RTD103): You have to set the RTD python version
404+
- [`RTD104`](https://learn.scientific-python.org/development/guides/docs#RTD104): You have to specify a build configuration now for readthedocs.
405+
391406
### Ruff
407+
392408
- [`RF001`](https://learn.scientific-python.org/development/guides/style#RF001): Has Ruff config
393409
- [`RF002`](https://learn.scientific-python.org/development/guides/style#RF002): Target version must be set
394410
- [`RF003`](https://learn.scientific-python.org/development/guides/style#RF003): src directory doesn't need to be specified anymore (0.6+)
@@ -399,6 +415,9 @@ for family, grp in itertools.groupby(collected.checks.items(), key=lambda x: x[1
399415
- `RF202`: Use (new) lint config section
400416

401417
### Setuptools Config
418+
419+
Will not show up if no `setup.cfg` file is present.
420+
402421
- [`SCFG001`](https://learn.scientific-python.org/development/guides/packaging-classic#SCFG001): Avoid deprecated setup.cfg names
403422

404423
<!-- [[[end]]] -->

src/sp_repo_review/checks/readthedocs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class ReadTheDocs:
14-
family = "docs"
14+
family = "rtd"
1515
url = mk_url("docs")
1616

1717

src/sp_repo_review/families.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Family(typing.TypedDict, total=False):
2121
name: str # defaults to key
2222
order: int # defaults to 0
2323
description: str # Defaults to empty
24+
readme_note: str # Not used repo-review
2425

2526

2627
def general_description(
@@ -113,6 +114,7 @@ def get_families(
113114
),
114115
"pre-commit": Family(
115116
name="Pre-commit",
117+
readme_note="Will not show up if using lefthook instead of pre-commit/prek.",
116118
),
117119
"mypy": Family(
118120
name="MyPy",
@@ -121,13 +123,16 @@ def get_families(
121123
name="Ruff",
122124
description=ruff_description(ruff),
123125
),
124-
"docs": Family(
125-
name="Documentation",
126+
"rtd": Family(
127+
name="ReadTheDocs",
128+
readme_note="Will not show up if no `.readthedocs.yml`/`.readthedocs.yaml` file is present.",
126129
),
127130
"setupcfg": Family(
128131
name="Setuptools Config",
132+
readme_note="Will not show up if no `setup.cfg` file is present.",
129133
),
130134
"noxfile": Family(
131135
name="Nox",
136+
readme_note="Will not show up if no `noxfile.py` file is present.",
132137
),
133138
}

0 commit comments

Comments
 (0)