Skip to content

Commit 15b89d7

Browse files
committed
doc update and pre-commit hook for auto doc generation
1 parent 31fee81 commit 15b89d7

File tree

3 files changed

+378
-5
lines changed

3 files changed

+378
-5
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ repos:
2121
- id: mypy
2222
args: [--install-types, --non-interactive, --explicit-package-bases, --allow-redefinition]
2323
language: system
24+
- repo: local
25+
hooks:
26+
- id: generate-plugin-docs
27+
name: Generate Plugin Documentation
28+
entry: bash -c 'python docs/generate_plugin_doc_bundle.py --package nodescraper.plugins.inband --output docs/PLUGIN_DOC.md && git add docs/PLUGIN_DOC.md'
29+
language: system
30+
files: ^nodescraper/plugins/inband/.*\.py$
31+
pass_filenames: false
32+
always_run: false

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,55 @@ When creating a PR, use the following process.
5252
> By creating a PR, you agree to allow your contribution to be licensed under the
5353
> terms of the LICENSE.txt file.
5454
55+
### Pre-commit hooks
56+
57+
This repository uses [pre-commit](https://pre-commit.com/) to automatically format code and generate documentation. When you commit changes to plugin files, the hooks will:
58+
59+
1. Run code formatters (ruff, black)
60+
2. Run type checking (mypy)
61+
3. Automatically regenerate plugin documentation (`docs/PLUGIN_DOC.md`)
62+
63+
#### Setup
64+
65+
Install pre-commit hooks after cloning the repository:
66+
67+
```bash
68+
# Activate your virtual environment
69+
source venv/bin/activate
70+
71+
# Install pre-commit hooks
72+
pre-commit install
73+
```
74+
75+
#### Usage
76+
77+
The hooks run automatically when you commit.
78+
79+
```bash
80+
# First commit attempt - hooks run and may modify files
81+
git commit -m "Add new plugin feature"
82+
83+
# If hooks modified files, stage them and commit again
84+
git add .
85+
git commit -m "Add new plugin feature"
86+
```
87+
88+
You can also run hooks manually:
89+
90+
```bash
91+
# Run all hooks on all files
92+
pre-commit run --all-files
93+
94+
# Run a specific hook
95+
pre-commit run generate-plugin-docs --all-files
96+
```
97+
98+
#### Plugin documentation
99+
100+
The `generate-plugin-docs` hook automatically regenerates `docs/PLUGIN_DOC.md` whenever plugin files in `nodescraper/plugins/inband/` are modified. This ensures the documentation stays in sync with the code.
101+
102+
If plugins are added or modified, the documentation will be automatically updated on the next commit.
103+
55104
### Documentation
56105

57106
Submit Node Scraper documentation changes to our

0 commit comments

Comments
 (0)