Skip to content

Commit f1d0157

Browse files
committed
Automatically update rule docs
1 parent 18dc302 commit f1d0157

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,15 @@ The rule naming conventions for XRLint are based ESLint:
8585
in a dedicated module under `tests`, i.e., `tests/rules/test_<rule>`.
8686
Consider using `xrlint.testing.RuleTester` which can save a lot of
8787
time and is used for almost all in-built rules.
88+
89+
## Contributing an XRLint Plugin
90+
91+
New plugins should be added to the `xrlint.rules` entry point table, which will cause them to be automatically loaded by XRLint, and to be included in the rule documentation.
92+
93+
```toml
94+
# pyproject.toml
95+
[project.entry-points."xrlint.rules"]
96+
core = "xrlint.plugins.core"
97+
xcube = "xrlint.plugins.xcube"
98+
acdd = "xrlint.plugins.acdd"
99+
```

docs/about.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@ mkdocs serve
7272
mkdocs gh-deploy
7373
```
7474

75-
The rule reference page is generated by a script called `mkruleref.py`.
76-
After changing or adding a rule, make sure you recreate the page:
77-
78-
```bash
79-
python -m mkruleref
80-
```
75+
The rule reference page is generated by a script called `docs/mkruleref.py` which is called by mkdocs during build.
8176

8277
## License
8378

docs/start.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ rule configurations:
6464
grid-mappings: error
6565
```
6666

67-
You can add rules from plugins as well:
68-
6967
!!! note inline end "Built in and auto-loading plugins"
7068

7169
The included plugins (such as `xcube` in the example configs here) and those from external libraries that are findable via [entry points](https://setuptools.pypa.io/en/latest/userguide/entry_point.html) do not need to be explicitly loaded.
7270

7371
Run `xrlint --print-config <dataset>` to view the loaded plugins and configured rules.
7472

73+
Custom plugins, or those that are not loadable via entry points will need to be explcitly loaded via the plugins object.
74+
75+
You can add rules from plugins as well:
76+
7577
```yaml
7678
- recommended
7779
- plugins:
@@ -83,8 +85,9 @@ And customize its rules, if desired:
8385

8486
```yaml
8587
- recommended
86-
- plugins:
87-
xcube: xrlint.plugins.xcube
88+
# Explicit loading of included plugins is unneeded, see note
89+
# - plugins:
90+
# xcube: xrlint.plugins.xcube
8891
- xcube/recommended
8992
- rules:
9093
xcube/grid-mapping-naming: off

mkdocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ extra:
4848
- icon: fontawesome/brands/python
4949
link: https://pypi.org/project/xrlint/
5050

51+
watch:
52+
- xrlint
53+
5154
plugins:
5255
- search
56+
# Build rule reference page
57+
- gen-files:
58+
scripts:
59+
- docs/mkruleref.py
5360
- autorefs
5461
- mkdocstrings:
5562
handlers:

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ doc = [
9090
"mkdocs-autorefs",
9191
"mkdocs-material",
9292
"mkdocstrings",
93-
"mkdocstrings-python"
93+
"mkdocstrings-python",
94+
"mkdocs-gen-files",
9495
]
9596

9697
[project.urls]

0 commit comments

Comments
 (0)