pydocfix 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pydocfix-0.1.0a1/.devcontainer/Dockerfile +14 -0
- pydocfix-0.1.0a1/.devcontainer/devcontainer.json +26 -0
- pydocfix-0.1.0a1/.github/copilot-instructions.md +6 -0
- pydocfix-0.1.0a1/.github/workflows/ci.yml +29 -0
- pydocfix-0.1.0a1/.github/workflows/release.yml +46 -0
- pydocfix-0.1.0a1/.gitignore +216 -0
- pydocfix-0.1.0a1/LICENSE +21 -0
- pydocfix-0.1.0a1/PKG-INFO +187 -0
- pydocfix-0.1.0a1/README.md +167 -0
- pydocfix-0.1.0a1/benchmarks/bench.py +414 -0
- pydocfix-0.1.0a1/pydocfix_rules.md +72 -0
- pydocfix-0.1.0a1/pydoclint_rules.md +79 -0
- pydocfix-0.1.0a1/pyproject.toml +55 -0
- pydocfix-0.1.0a1/src/pydocfix/__init__.py +3 -0
- pydocfix-0.1.0a1/src/pydocfix/checker.py +484 -0
- pydocfix-0.1.0a1/src/pydocfix/cli.py +269 -0
- pydocfix-0.1.0a1/src/pydocfix/config.py +76 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/__init__.py +211 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/_base.py +312 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/doc/__init__.py +5 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/doc/doc001.py +211 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/__init__.py +35 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/_helpers.py +122 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm001.py +85 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm002.py +49 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm003.py +40 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm004.py +74 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm005.py +54 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm006.py +106 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm007.py +60 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm008.py +40 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm009.py +58 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm101.py +72 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm102.py +49 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm103.py +68 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm104.py +78 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm201.py +90 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/prm/prm202.py +84 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/__init__.py +15 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/_helpers.py +89 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/ris001.py +90 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/ris002.py +49 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/ris003.py +35 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/ris004.py +67 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/ris/ris005.py +52 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/__init__.py +19 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/_helpers.py +30 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn001.py +77 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn002.py +52 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn003.py +35 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn101.py +52 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn102.py +38 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn103.py +60 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/rtn/rtn104.py +54 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/sum/__init__.py +9 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/sum/sum001.py +37 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/sum/sum002.py +35 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/__init__.py +19 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/_helpers.py +67 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld001.py +83 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld002.py +48 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld003.py +35 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld101.py +48 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld102.py +38 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld103.py +60 -0
- pydocfix-0.1.0a1/src/pydocfix/rules/yld/yld104.py +50 -0
- pydocfix-0.1.0a1/tests/__init__.py +0 -0
- pydocfix-0.1.0a1/tests/test_checker.py +138 -0
- pydocfix-0.1.0a1/tests/test_cli.py +119 -0
- pydocfix-0.1.0a1/tests/test_config.py +152 -0
- pydocfix-0.1.0a1/tests/test_fixer.py +193 -0
- pydocfix-0.1.0a1/tests/test_rules.py +3239 -0
- pydocfix-0.1.0a1/uv.lock +325 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
FROM python:3.13.12-bookworm
|
|
2
|
+
|
|
3
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
4
|
+
|
|
5
|
+
RUN apt update && apt install -y --no-install-recommends \
|
|
6
|
+
git \
|
|
7
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
8
|
+
|
|
9
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
|
|
10
|
+
RUN uv pip install --system pydocstring-rs
|
|
11
|
+
|
|
12
|
+
RUN mkdir -p /workspace
|
|
13
|
+
|
|
14
|
+
WORKDIR /workspace
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pydocfix",
|
|
3
|
+
"build": {
|
|
4
|
+
"dockerfile": "Dockerfile"
|
|
5
|
+
},
|
|
6
|
+
"customizations": {
|
|
7
|
+
"vscode": {
|
|
8
|
+
"extensions": [
|
|
9
|
+
"ms-python.python",
|
|
10
|
+
"charliermarsh.ruff"
|
|
11
|
+
],
|
|
12
|
+
"settings": {
|
|
13
|
+
"editor.formatOnSave": true,
|
|
14
|
+
"python.analysis.extraPaths": [
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"[python]": {
|
|
18
|
+
"editor.codeActionsOnSave": {
|
|
19
|
+
"source.organizeImports": "explicit"
|
|
20
|
+
},
|
|
21
|
+
"editor.defaultFormatter": "charliermarsh.ruff"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
pip install -e . pytest pytest-cov
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: pytest tests/ --tb=short -q
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: pip install -e . pytest pytest-cov
|
|
21
|
+
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: pytest tests/ --tb=short -q
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: test
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: release
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write # for trusted publishing
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- name: Set up Python
|
|
36
|
+
uses: actions/setup-python@v5
|
|
37
|
+
with:
|
|
38
|
+
python-version: "3.13"
|
|
39
|
+
|
|
40
|
+
- name: Build package
|
|
41
|
+
run: |
|
|
42
|
+
pip install build
|
|
43
|
+
python -m build
|
|
44
|
+
|
|
45
|
+
- name: Publish to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
pydocfix-0.1.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryuma Asai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pydocfix
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: A Python docstring linter with auto-fix support
|
|
5
|
+
Author: Ryuma Asai
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: click>=8.0
|
|
18
|
+
Requires-Dist: pydocstring-rs>=0.1.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# pydocfix
|
|
22
|
+
|
|
23
|
+
A Python docstring linter that checks **signature ↔ docstring consistency** and **auto-fixes** violations.
|
|
24
|
+
|
|
25
|
+
> [!WARNING]
|
|
26
|
+
> This project is currently under active development (v0.1.0a1).
|
|
27
|
+
> APIs and behavior may change without notice.
|
|
28
|
+
|
|
29
|
+
## Why pydocfix?
|
|
30
|
+
|
|
31
|
+
Existing signature ↔ docstring consistency checkers (such as pydoclint) can report violations but cannot fix them — leaving all corrections to the developer.
|
|
32
|
+
|
|
33
|
+
pydocfix is built on [pydocstring-rs](https://github.com/aita/pydocstring-rs), a **CST (Concrete Syntax Tree) parser** for docstrings written in Rust by the same author. CST preserves every token's byte offset, whitespace, and formatting, enabling:
|
|
34
|
+
|
|
35
|
+
- **Byte-level diagnostics** — point to the exact token (parameter name, type annotation, section header), not just the line
|
|
36
|
+
- **Surgical auto-fix** — edits replace precise byte ranges, so fixes never corrupt adjacent content
|
|
37
|
+
- **Iterative fix loop** — apply non-overlapping fixes, re-parse, repeat until stable
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Auto-fix** — Automatically repair docstring issues with safe/unsafe classification
|
|
42
|
+
- **35 rules** across 6 categories: Summary, Parameters, Returns, Yields, Raises, Docstring
|
|
43
|
+
- **Google & NumPy style** support (powered by [pydocstring-rs](https://github.com/aita/pydocstring-rs))
|
|
44
|
+
- **Signature ↔ docstring consistency** — type mismatches, missing/extra parameters, ordering
|
|
45
|
+
- **Default value checking** — detect missing `optional` / `default` annotations
|
|
46
|
+
- **Precise diagnostics** — byte-level position information for every violation
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install pydocfix
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requires Python 3.11+.
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Check docstrings (report only)
|
|
60
|
+
pydocfix check src/
|
|
61
|
+
|
|
62
|
+
# Show diff of proposed fixes
|
|
63
|
+
pydocfix check src/ --diff
|
|
64
|
+
|
|
65
|
+
# Apply safe fixes
|
|
66
|
+
pydocfix check src/ --fix
|
|
67
|
+
|
|
68
|
+
# Apply safe + unsafe fixes
|
|
69
|
+
pydocfix check src/ --fix --unsafe-fixes
|
|
70
|
+
|
|
71
|
+
# Enable all rules (including non-default)
|
|
72
|
+
pydocfix check src/ --select ALL
|
|
73
|
+
|
|
74
|
+
# Select specific rules
|
|
75
|
+
pydocfix check src/ --select PRM,RTN
|
|
76
|
+
|
|
77
|
+
# Ignore specific rules
|
|
78
|
+
pydocfix check src/ --ignore SUM001,PRM008
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Configure via `pyproject.toml`:
|
|
84
|
+
|
|
85
|
+
```toml
|
|
86
|
+
[tool.pydocfix]
|
|
87
|
+
# Rules to enable (overrides defaults); supports category prefixes and "ALL"
|
|
88
|
+
select = ["ALL"]
|
|
89
|
+
|
|
90
|
+
# Rules to disable
|
|
91
|
+
ignore = ["PRM001", "RTN001", "YLD001", "RIS001"]
|
|
92
|
+
|
|
93
|
+
# Type annotation style: "signature" (default) or "docstring"
|
|
94
|
+
type_annotation_style = "signature"
|
|
95
|
+
|
|
96
|
+
# Paths/patterns to exclude (in addition to built-in defaults)
|
|
97
|
+
exclude = ["tests/", "docs/"]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Rules
|
|
101
|
+
|
|
102
|
+
35 rules across 6 categories. Each rule is classified as **safe** fix, **unsafe** fix, or report-only.
|
|
103
|
+
|
|
104
|
+
- **Safe** fixes can be applied automatically with `--fix` (no risk of changing semantics)
|
|
105
|
+
- **Unsafe** fixes require `--fix --unsafe-fixes` (may alter docstring meaning)
|
|
106
|
+
|
|
107
|
+
### Summary (SUM)
|
|
108
|
+
|
|
109
|
+
| Code | Default | Fix | Description |
|
|
110
|
+
|------|:-------:|:---:|-------------|
|
|
111
|
+
| SUM001 | ✅ | — | Missing summary line |
|
|
112
|
+
| SUM002 | ✅ | safe | Summary doesn't end with period |
|
|
113
|
+
|
|
114
|
+
### Parameters (PRM)
|
|
115
|
+
|
|
116
|
+
| Code | Default | Fix | Description |
|
|
117
|
+
|------|:-------:|:---:|-------------|
|
|
118
|
+
| PRM001 | ✅ | unsafe | Missing Args/Parameters section |
|
|
119
|
+
| PRM002 | ✅ | safe | Unnecessary Args/Parameters section |
|
|
120
|
+
| PRM003 | ✅ | safe | `self`/`cls` documented in docstring |
|
|
121
|
+
| PRM004 | ✅ | unsafe | Parameter in signature missing from docstring |
|
|
122
|
+
| PRM005 | ✅ | unsafe | Parameter in docstring not in signature |
|
|
123
|
+
| PRM006 | ✅ | unsafe | Parameter order mismatch |
|
|
124
|
+
| PRM007 | ✅ | unsafe | Duplicate parameter name |
|
|
125
|
+
| PRM008 | ✅ | — | Parameter has no description |
|
|
126
|
+
| PRM009 | ✅ | safe | Missing `*`/`**` prefix on `*args`/`**kwargs` |
|
|
127
|
+
| PRM101 | ✅ | unsafe | Docstring type doesn't match signature annotation |
|
|
128
|
+
| PRM102 | ✅ | unsafe | No type in docstring or signature |
|
|
129
|
+
| PRM103 | | safe | Redundant type in docstring (signature has annotation) |
|
|
130
|
+
| PRM104 | | unsafe | No type in docstring |
|
|
131
|
+
| PRM201 | ✅ | unsafe | Missing `optional` for parameter with default |
|
|
132
|
+
| PRM202 | | unsafe | Missing `default` for parameter with default |
|
|
133
|
+
|
|
134
|
+
### Returns (RTN)
|
|
135
|
+
|
|
136
|
+
| Code | Default | Fix | Description |
|
|
137
|
+
|------|:-------:|:---:|-------------|
|
|
138
|
+
| RTN001 | ✅ | unsafe | Missing Returns section |
|
|
139
|
+
| RTN002 | ✅ | safe | Unnecessary Returns section |
|
|
140
|
+
| RTN003 | ✅ | — | Returns entry has no description |
|
|
141
|
+
| RTN101 | ✅ | unsafe | Return type mismatch |
|
|
142
|
+
| RTN102 | ✅ | unsafe | No return type anywhere |
|
|
143
|
+
| RTN103 | | safe | Redundant return type in docstring |
|
|
144
|
+
| RTN104 | | unsafe | No return type in docstring |
|
|
145
|
+
|
|
146
|
+
### Yields (YLD)
|
|
147
|
+
|
|
148
|
+
| Code | Default | Fix | Description |
|
|
149
|
+
|------|:-------:|:---:|-------------|
|
|
150
|
+
| YLD001 | ✅ | unsafe | Missing Yields section |
|
|
151
|
+
| YLD002 | ✅ | safe | Unnecessary Yields section |
|
|
152
|
+
| YLD003 | ✅ | — | Yields entry has no description |
|
|
153
|
+
| YLD101 | ✅ | unsafe | Yield type mismatch |
|
|
154
|
+
| YLD102 | ✅ | unsafe | No yield type anywhere |
|
|
155
|
+
| YLD103 | | safe | Redundant yield type in docstring |
|
|
156
|
+
| YLD104 | | unsafe | No yield type in docstring |
|
|
157
|
+
|
|
158
|
+
### Raises (RIS)
|
|
159
|
+
|
|
160
|
+
| Code | Default | Fix | Description |
|
|
161
|
+
|------|:-------:|:---:|-------------|
|
|
162
|
+
| RIS001 | ✅ | unsafe | Missing Raises section |
|
|
163
|
+
| RIS002 | ✅ | safe | Unnecessary Raises section |
|
|
164
|
+
| RIS003 | ✅ | — | Raises entry has no description |
|
|
165
|
+
| RIS004 | ✅ | unsafe | Raised exception not documented |
|
|
166
|
+
| RIS005 | ✅ | unsafe | Documented exception not raised |
|
|
167
|
+
|
|
168
|
+
### Docstring (DOC)
|
|
169
|
+
|
|
170
|
+
| Code | Default | Fix | Description |
|
|
171
|
+
|------|:-------:|:---:|-------------|
|
|
172
|
+
| DOC001 | ✅ | unsafe | Section order doesn't match convention |
|
|
173
|
+
|
|
174
|
+
## Benchmark
|
|
175
|
+
|
|
176
|
+
pydocfix performs linting **and** auto-fix generation in a single pass, yet achieves comparable speed to lint-only tools. Below is a comparison with [pydoclint](https://github.com/jsh9/pydoclint), the closest tool in scope (signature ↔ docstring consistency checking, lint-only):
|
|
177
|
+
|
|
178
|
+
| Project | Files | Lines | pydocfix | pydoclint |
|
|
179
|
+
|---------|------:|------:|---------:|----------:|
|
|
180
|
+
| [numpy](https://github.com/numpy/numpy) | 425 | 251K | 4.2 sec | 4.6 sec |
|
|
181
|
+
| [scikit-learn](https://github.com/scikit-learn/scikit-learn) | 635 | 372K | 4.1 sec | 5.3 sec |
|
|
182
|
+
|
|
183
|
+
> pydocfix is in early development. The majority of processing time is spent in the Rust-based CST parser (pydocstring-rs); adding more Python-side rules has limited impact on overall throughput.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT
|