pynudger 0.1.0__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.
- pynudger-0.1.0/LICENSE.md +1 -0
- pynudger-0.1.0/PKG-INFO +265 -0
- pynudger-0.1.0/README.md +238 -0
- pynudger-0.1.0/pyproject.toml +761 -0
- pynudger-0.1.0/src/pynudger/__init__.py +14 -0
- pynudger-0.1.0/src/pynudger/__main__.py +13 -0
- pynudger-0.1.0/src/pynudger/_check.py +358 -0
- pynudger-0.1.0/src/pynudger/_cli.py +57 -0
- pynudger-0.1.0/src/pynudger/_loader.py +89 -0
- pynudger-0.1.0/src/pynudger/_rule.py +169 -0
- pynudger-0.1.0/src/pynudger/py.typed +0 -0
- pynudger-0.1.0/src/pynudger/py.typed.license +4 -0
- pynudger-0.1.0/tests/README.md +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LICENSES/Apache-2.0.txt
|
pynudger-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pynudger
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: opennudge Python linter (naming conventions and other automated checks)
|
|
5
|
+
Author: open-nudge
|
|
6
|
+
Maintainer: open-nudge
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
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 :: Libraries
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Project-URL: Changelog, https://github.com/open-nudge/pynudger/blob/master/CHANGELOG.md
|
|
19
|
+
Project-URL: Documentation, https://open-nudge.github.io/pynudger
|
|
20
|
+
Project-URL: Homepage, https://open-nudge.github.io/pynudger
|
|
21
|
+
Project-URL: Issues, https://github.com/open-nudge/pynudger/issues
|
|
22
|
+
Project-URL: Repository, https://github.com/open-nudge/pynudger
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: lintkit[rich]>=0.2.1
|
|
25
|
+
Requires-Dist: loadfig>=0.1.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
<!--
|
|
29
|
+
SPDX-FileCopyrightText: © 2025 open-nudge <https://github.com/open-nudge>
|
|
30
|
+
SPDX-FileContributor: szymonmaszke <github@maszke.co>
|
|
31
|
+
|
|
32
|
+
SPDX-License-Identifier: Apache-2.0
|
|
33
|
+
-->
|
|
34
|
+
|
|
35
|
+
# pynudger
|
|
36
|
+
|
|
37
|
+
<!-- mkdocs remove start -->
|
|
38
|
+
|
|
39
|
+
<!-- vale off -->
|
|
40
|
+
|
|
41
|
+
<!-- pyml disable-num-lines 30 line-length-->
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<em>opennudge Python linter (naming conventions and other automated checks)</em>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<div align="center">
|
|
48
|
+
|
|
49
|
+
<a href="https://pypi.org/project/pynudger">
|
|
50
|
+
</a>
|
|
51
|
+
<a href="https://pypi.org/project/pynudger">
|
|
52
|
+
</a>
|
|
53
|
+
<a href="https://opensource.org/licenses/Apache-2.0">
|
|
54
|
+
</a>
|
|
55
|
+
<a>
|
|
56
|
+
</a>
|
|
57
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/open-nudge/pynudger">
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
✨ <a href="#features">Features</a>
|
|
64
|
+
🚀 <a href="#quick-start">Quick start</a>
|
|
65
|
+
📚 <a href="https://open-nudge.github.io/pynudger">Documentation</a>
|
|
66
|
+
🤝 <a href="#contribute">Contribute</a>
|
|
67
|
+
👍 <a href="https://github.com/open-nudge/pynudger/blob/main/ADOPTERS.md">Adopters</a>
|
|
68
|
+
📜 <a href="#legal">Legal</a>
|
|
69
|
+
</p>
|
|
70
|
+
<!-- vale on -->
|
|
71
|
+
|
|
72
|
+
______________________________________________________________________
|
|
73
|
+
|
|
74
|
+
<!-- mkdocs remove end -->
|
|
75
|
+
|
|
76
|
+
## Features
|
|
77
|
+
|
|
78
|
+
__pynudger__ is an opinionated linter for Python projects, focused on
|
|
79
|
+
naming conventions and making your code "more Pythonic".
|
|
80
|
+
|
|
81
|
+
- __Length rules__: Too long class/function names are flagged.
|
|
82
|
+
- __Setters/getters__: Discourages usage of setters/getters,
|
|
83
|
+
encourages properties instead.
|
|
84
|
+
- __No helpers/utils/commons__: Incentivizes more descriptive
|
|
85
|
+
and semantically coherent names for functionalities.
|
|
86
|
+
|
|
87
|
+
## Table of contents
|
|
88
|
+
|
|
89
|
+
- [Quick start](#quick-start)
|
|
90
|
+
- [Installation](#installation)
|
|
91
|
+
- [Usage](#usage)
|
|
92
|
+
- [Advanced](#advanced)
|
|
93
|
+
- [Configuration](#configuration)
|
|
94
|
+
- [Run as a pre-commit hook](#run-as-a-pre-commit-hook)
|
|
95
|
+
- [Disable in code](#disable-in-code)
|
|
96
|
+
- [Rules](#rules)
|
|
97
|
+
|
|
98
|
+
## Quick start
|
|
99
|
+
|
|
100
|
+
### Installation
|
|
101
|
+
|
|
102
|
+
> [!TIP]
|
|
103
|
+
> You can use your favorite package manager like
|
|
104
|
+
> [`uv`](https://github.com/astral-sh/uv),
|
|
105
|
+
> [`hatch`](https://github.com/pypa/hatch)
|
|
106
|
+
> or [`pdm`](https://github.com/pdm-project/pdm)
|
|
107
|
+
> instead of `pip`.
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
> pip install pynudger
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Usage
|
|
114
|
+
|
|
115
|
+
To check against the rules run the following from the command line:
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
> pynudger check
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
You can pass additional arguments to `pynudger check`, like files
|
|
122
|
+
to check (by default all Python files in the current directory):
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
> pynudger check path/to/file.py another_file.py
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Advanced
|
|
129
|
+
|
|
130
|
+
### Configuration
|
|
131
|
+
|
|
132
|
+
You can configure pynudger in `pyproject.toml` (or `.pynudger.toml`
|
|
133
|
+
in the root of your project, just remove the `[tool.pynudger]` section),
|
|
134
|
+
for example:
|
|
135
|
+
|
|
136
|
+
```toml
|
|
137
|
+
[tool.pynudger]
|
|
138
|
+
# include rules by their code
|
|
139
|
+
include_codes = [1, 2, 5] # default: all rules included
|
|
140
|
+
# exclude rules by their code (takes precedence over include)
|
|
141
|
+
exclude_codes = [4, 5, 6] # default: no rules excluded
|
|
142
|
+
# whether to exit after first error or all errors
|
|
143
|
+
end_mode = "first" # default: "all"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> [!TIP]
|
|
147
|
+
> Rule-specific configuration can be found in the section below.
|
|
148
|
+
|
|
149
|
+
### Run as a pre-commit hook
|
|
150
|
+
|
|
151
|
+
`pynudger` can be used as a pre-commit hook, to add as a plugin:
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
repos:
|
|
155
|
+
- repo: "https://github.com/open-nudge/pynudger"
|
|
156
|
+
rev: ... # select the tag or revision you want, or run `pre-commit autoupdate`
|
|
157
|
+
hooks:
|
|
158
|
+
- id: "pynudger"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Disable in code
|
|
162
|
+
|
|
163
|
+
You can disable `pynudger` on a line-by-line basis
|
|
164
|
+
(you have to specify exact code), e.g.:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
def set_my_too_long_function_name(): # noqa: PYNUDGER0, PYNUDGER16
|
|
168
|
+
pass
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
or a line span:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
# noqa-start: PYNUDGER0, PYNUDGER16
|
|
175
|
+
def set_my_too_long_function_name():
|
|
176
|
+
pass
|
|
177
|
+
|
|
178
|
+
def set_another_long_function():
|
|
179
|
+
pass
|
|
180
|
+
# noqa-end: PYNUDGER0, PYNUDGER16
|
|
181
|
+
|
|
182
|
+
def set_will_error_out_this_time():
|
|
183
|
+
pass
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
It is also possible to disable all checks in a file
|
|
187
|
+
by placing the following somewhere in the file (preferably at the top):
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
# noqa-file: PYNUDGER0, PYNUDGER16
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
> [!NOTE]
|
|
194
|
+
> If you are running `pynudger` with
|
|
195
|
+
> [`ruff`](https://github.com/astral-sh/ruff) you should add
|
|
196
|
+
> `lint.external = ["PYNUDGER"]` to `[tool.ruff]` section in
|
|
197
|
+
> `pyproject.toml` to avoid removing `# noqa: PYNUDGER` comments.
|
|
198
|
+
|
|
199
|
+
### Rules
|
|
200
|
+
|
|
201
|
+
> [!TIP]
|
|
202
|
+
> Run `pynudger rules` to see the list of available rules.
|
|
203
|
+
|
|
204
|
+
`pynudger` provides the following rules:
|
|
205
|
+
|
|
206
|
+
<!-- pyml disable-num-lines 25 line-length-->
|
|
207
|
+
|
|
208
|
+
| Name | Description |
|
|
209
|
+
| ------------ | ------------------------------------------------------------------------- |
|
|
210
|
+
| `PYNUDGER0` | Avoid using setters in class names. Use properties instead. |
|
|
211
|
+
| `PYNUDGER1` | Avoid using setters in function names. Use properties instead. |
|
|
212
|
+
| `PYNUDGER2` | Avoid using setters in file names. Define file name without it. |
|
|
213
|
+
| `PYNUDGER3` | Avoid using getters in class names. Use properties instead. |
|
|
214
|
+
| `PYNUDGER4` | Avoid using getters in function names. Use properties instead. |
|
|
215
|
+
| `PYNUDGER5` | Avoid using getters in file names. Define file name without it. |
|
|
216
|
+
| `PYNUDGER6` | Avoid using utils in class names. Name the class appropriately. |
|
|
217
|
+
| `PYNUDGER7` | Avoid using utils in function names. Name the function appropriately. |
|
|
218
|
+
| `PYNUDGER8` | Avoid defining utils modules. Move functionality to appropriate modules. |
|
|
219
|
+
| `PYNUDGER9` | Avoid using helpers in class names. Name the class appropriately. |
|
|
220
|
+
| `PYNUDGER10` | Avoid using helpers in function names. Name the function appropriately. |
|
|
221
|
+
| `PYNUDGER11` | Avoid defining utils modules. Move functionality to appropriate modules. |
|
|
222
|
+
| `PYNUDGER12` | Avoid using common in class names. Name the class appropriately. |
|
|
223
|
+
| `PYNUDGER13` | Avoid using common in function names. Name the function appropriately. |
|
|
224
|
+
| `PYNUDGER14` | Avoid defining common modules. Move functionality to appropriate modules. |
|
|
225
|
+
| `PYNUDGER15` | Avoid long class names. Specify intent by nesting modules/packages. |
|
|
226
|
+
| `PYNUDGER16` | Avoid long function names. Specify intent by nesting modules/packages. |
|
|
227
|
+
| `PYNUDGER17` | Avoid long path names. Specify intent by nesting modules/packages. |
|
|
228
|
+
|
|
229
|
+
with the following configurable options (in `pyproject.toml`
|
|
230
|
+
or `.pynudger.toml`):
|
|
231
|
+
|
|
232
|
+
<!-- pyml disable-num-lines 10 line-length-->
|
|
233
|
+
|
|
234
|
+
| Option | Description | Affected rules | Default |
|
|
235
|
+
| ----------------- | ----------------------------------------------------- | ---------------------- | ------- |
|
|
236
|
+
| `pascal_length` | Maximum allowed length of PascalCase names | PYNUDGER15 | 3 |
|
|
237
|
+
| `snake_length` | Maximum allowed length of snake_case names | PYNUDGER16, PYNUDGER17 | 3 |
|
|
238
|
+
| `pascal_excludes` | List of words to exclude from PascalCase length check | PYNUDGER15 | [] |
|
|
239
|
+
| `snake_excludes` | List of words to exclude from snake_case length check | PYNUDGER16, PYNUDGER17 | [] |
|
|
240
|
+
|
|
241
|
+
## Contribute
|
|
242
|
+
|
|
243
|
+
<!-- md-dead-link-check: off -->
|
|
244
|
+
|
|
245
|
+
<!-- mkdocs remove start -->
|
|
246
|
+
|
|
247
|
+
We welcome your contributions! Start here:
|
|
248
|
+
|
|
249
|
+
- [Code of Conduct](/CODE_OF_CONDUCT.md)
|
|
250
|
+
- [Contributing Guide](/CONTRIBUTING.md)
|
|
251
|
+
- [Roadmap](/ROADMAP.md)
|
|
252
|
+
- [Changelog](/CHANGELOG.md)
|
|
253
|
+
- [Report security vulnerabilities](/SECURITY.md)
|
|
254
|
+
- [Open an Issue](https://github.com/open-nudge/pynudger/issues)
|
|
255
|
+
|
|
256
|
+
## Legal
|
|
257
|
+
|
|
258
|
+
- This project is licensed under the _Apache 2.0 License_ - see
|
|
259
|
+
the [LICENSE](/LICENSE.md) file for details.
|
|
260
|
+
- This project is copyrighted by _open-nudge_ - the
|
|
261
|
+
appropriate copyright notice is included in each file.
|
|
262
|
+
|
|
263
|
+
<!-- mkdocs remove end -->
|
|
264
|
+
|
|
265
|
+
<!-- md-dead-link-check: on -->
|
pynudger-0.1.0/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: © 2025 open-nudge <https://github.com/open-nudge>
|
|
3
|
+
SPDX-FileContributor: szymonmaszke <github@maszke.co>
|
|
4
|
+
|
|
5
|
+
SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# pynudger
|
|
9
|
+
|
|
10
|
+
<!-- mkdocs remove start -->
|
|
11
|
+
|
|
12
|
+
<!-- vale off -->
|
|
13
|
+
|
|
14
|
+
<!-- pyml disable-num-lines 30 line-length-->
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<em>opennudge Python linter (naming conventions and other automated checks)</em>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
|
|
22
|
+
<a href="https://pypi.org/project/pynudger">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://pypi.org/project/pynudger">
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://opensource.org/licenses/Apache-2.0">
|
|
27
|
+
</a>
|
|
28
|
+
<a>
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/open-nudge/pynudger">
|
|
31
|
+
</a>
|
|
32
|
+
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
✨ <a href="#features">Features</a>
|
|
37
|
+
🚀 <a href="#quick-start">Quick start</a>
|
|
38
|
+
📚 <a href="https://open-nudge.github.io/pynudger">Documentation</a>
|
|
39
|
+
🤝 <a href="#contribute">Contribute</a>
|
|
40
|
+
👍 <a href="https://github.com/open-nudge/pynudger/blob/main/ADOPTERS.md">Adopters</a>
|
|
41
|
+
📜 <a href="#legal">Legal</a>
|
|
42
|
+
</p>
|
|
43
|
+
<!-- vale on -->
|
|
44
|
+
|
|
45
|
+
______________________________________________________________________
|
|
46
|
+
|
|
47
|
+
<!-- mkdocs remove end -->
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
__pynudger__ is an opinionated linter for Python projects, focused on
|
|
52
|
+
naming conventions and making your code "more Pythonic".
|
|
53
|
+
|
|
54
|
+
- __Length rules__: Too long class/function names are flagged.
|
|
55
|
+
- __Setters/getters__: Discourages usage of setters/getters,
|
|
56
|
+
encourages properties instead.
|
|
57
|
+
- __No helpers/utils/commons__: Incentivizes more descriptive
|
|
58
|
+
and semantically coherent names for functionalities.
|
|
59
|
+
|
|
60
|
+
## Table of contents
|
|
61
|
+
|
|
62
|
+
- [Quick start](#quick-start)
|
|
63
|
+
- [Installation](#installation)
|
|
64
|
+
- [Usage](#usage)
|
|
65
|
+
- [Advanced](#advanced)
|
|
66
|
+
- [Configuration](#configuration)
|
|
67
|
+
- [Run as a pre-commit hook](#run-as-a-pre-commit-hook)
|
|
68
|
+
- [Disable in code](#disable-in-code)
|
|
69
|
+
- [Rules](#rules)
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
### Installation
|
|
74
|
+
|
|
75
|
+
> [!TIP]
|
|
76
|
+
> You can use your favorite package manager like
|
|
77
|
+
> [`uv`](https://github.com/astral-sh/uv),
|
|
78
|
+
> [`hatch`](https://github.com/pypa/hatch)
|
|
79
|
+
> or [`pdm`](https://github.com/pdm-project/pdm)
|
|
80
|
+
> instead of `pip`.
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
> pip install pynudger
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Usage
|
|
87
|
+
|
|
88
|
+
To check against the rules run the following from the command line:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
> pynudger check
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
You can pass additional arguments to `pynudger check`, like files
|
|
95
|
+
to check (by default all Python files in the current directory):
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
> pynudger check path/to/file.py another_file.py
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Advanced
|
|
102
|
+
|
|
103
|
+
### Configuration
|
|
104
|
+
|
|
105
|
+
You can configure pynudger in `pyproject.toml` (or `.pynudger.toml`
|
|
106
|
+
in the root of your project, just remove the `[tool.pynudger]` section),
|
|
107
|
+
for example:
|
|
108
|
+
|
|
109
|
+
```toml
|
|
110
|
+
[tool.pynudger]
|
|
111
|
+
# include rules by their code
|
|
112
|
+
include_codes = [1, 2, 5] # default: all rules included
|
|
113
|
+
# exclude rules by their code (takes precedence over include)
|
|
114
|
+
exclude_codes = [4, 5, 6] # default: no rules excluded
|
|
115
|
+
# whether to exit after first error or all errors
|
|
116
|
+
end_mode = "first" # default: "all"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> [!TIP]
|
|
120
|
+
> Rule-specific configuration can be found in the section below.
|
|
121
|
+
|
|
122
|
+
### Run as a pre-commit hook
|
|
123
|
+
|
|
124
|
+
`pynudger` can be used as a pre-commit hook, to add as a plugin:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
repos:
|
|
128
|
+
- repo: "https://github.com/open-nudge/pynudger"
|
|
129
|
+
rev: ... # select the tag or revision you want, or run `pre-commit autoupdate`
|
|
130
|
+
hooks:
|
|
131
|
+
- id: "pynudger"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Disable in code
|
|
135
|
+
|
|
136
|
+
You can disable `pynudger` on a line-by-line basis
|
|
137
|
+
(you have to specify exact code), e.g.:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
def set_my_too_long_function_name(): # noqa: PYNUDGER0, PYNUDGER16
|
|
141
|
+
pass
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
or a line span:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# noqa-start: PYNUDGER0, PYNUDGER16
|
|
148
|
+
def set_my_too_long_function_name():
|
|
149
|
+
pass
|
|
150
|
+
|
|
151
|
+
def set_another_long_function():
|
|
152
|
+
pass
|
|
153
|
+
# noqa-end: PYNUDGER0, PYNUDGER16
|
|
154
|
+
|
|
155
|
+
def set_will_error_out_this_time():
|
|
156
|
+
pass
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
It is also possible to disable all checks in a file
|
|
160
|
+
by placing the following somewhere in the file (preferably at the top):
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
# noqa-file: PYNUDGER0, PYNUDGER16
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
> [!NOTE]
|
|
167
|
+
> If you are running `pynudger` with
|
|
168
|
+
> [`ruff`](https://github.com/astral-sh/ruff) you should add
|
|
169
|
+
> `lint.external = ["PYNUDGER"]` to `[tool.ruff]` section in
|
|
170
|
+
> `pyproject.toml` to avoid removing `# noqa: PYNUDGER` comments.
|
|
171
|
+
|
|
172
|
+
### Rules
|
|
173
|
+
|
|
174
|
+
> [!TIP]
|
|
175
|
+
> Run `pynudger rules` to see the list of available rules.
|
|
176
|
+
|
|
177
|
+
`pynudger` provides the following rules:
|
|
178
|
+
|
|
179
|
+
<!-- pyml disable-num-lines 25 line-length-->
|
|
180
|
+
|
|
181
|
+
| Name | Description |
|
|
182
|
+
| ------------ | ------------------------------------------------------------------------- |
|
|
183
|
+
| `PYNUDGER0` | Avoid using setters in class names. Use properties instead. |
|
|
184
|
+
| `PYNUDGER1` | Avoid using setters in function names. Use properties instead. |
|
|
185
|
+
| `PYNUDGER2` | Avoid using setters in file names. Define file name without it. |
|
|
186
|
+
| `PYNUDGER3` | Avoid using getters in class names. Use properties instead. |
|
|
187
|
+
| `PYNUDGER4` | Avoid using getters in function names. Use properties instead. |
|
|
188
|
+
| `PYNUDGER5` | Avoid using getters in file names. Define file name without it. |
|
|
189
|
+
| `PYNUDGER6` | Avoid using utils in class names. Name the class appropriately. |
|
|
190
|
+
| `PYNUDGER7` | Avoid using utils in function names. Name the function appropriately. |
|
|
191
|
+
| `PYNUDGER8` | Avoid defining utils modules. Move functionality to appropriate modules. |
|
|
192
|
+
| `PYNUDGER9` | Avoid using helpers in class names. Name the class appropriately. |
|
|
193
|
+
| `PYNUDGER10` | Avoid using helpers in function names. Name the function appropriately. |
|
|
194
|
+
| `PYNUDGER11` | Avoid defining utils modules. Move functionality to appropriate modules. |
|
|
195
|
+
| `PYNUDGER12` | Avoid using common in class names. Name the class appropriately. |
|
|
196
|
+
| `PYNUDGER13` | Avoid using common in function names. Name the function appropriately. |
|
|
197
|
+
| `PYNUDGER14` | Avoid defining common modules. Move functionality to appropriate modules. |
|
|
198
|
+
| `PYNUDGER15` | Avoid long class names. Specify intent by nesting modules/packages. |
|
|
199
|
+
| `PYNUDGER16` | Avoid long function names. Specify intent by nesting modules/packages. |
|
|
200
|
+
| `PYNUDGER17` | Avoid long path names. Specify intent by nesting modules/packages. |
|
|
201
|
+
|
|
202
|
+
with the following configurable options (in `pyproject.toml`
|
|
203
|
+
or `.pynudger.toml`):
|
|
204
|
+
|
|
205
|
+
<!-- pyml disable-num-lines 10 line-length-->
|
|
206
|
+
|
|
207
|
+
| Option | Description | Affected rules | Default |
|
|
208
|
+
| ----------------- | ----------------------------------------------------- | ---------------------- | ------- |
|
|
209
|
+
| `pascal_length` | Maximum allowed length of PascalCase names | PYNUDGER15 | 3 |
|
|
210
|
+
| `snake_length` | Maximum allowed length of snake_case names | PYNUDGER16, PYNUDGER17 | 3 |
|
|
211
|
+
| `pascal_excludes` | List of words to exclude from PascalCase length check | PYNUDGER15 | [] |
|
|
212
|
+
| `snake_excludes` | List of words to exclude from snake_case length check | PYNUDGER16, PYNUDGER17 | [] |
|
|
213
|
+
|
|
214
|
+
## Contribute
|
|
215
|
+
|
|
216
|
+
<!-- md-dead-link-check: off -->
|
|
217
|
+
|
|
218
|
+
<!-- mkdocs remove start -->
|
|
219
|
+
|
|
220
|
+
We welcome your contributions! Start here:
|
|
221
|
+
|
|
222
|
+
- [Code of Conduct](/CODE_OF_CONDUCT.md)
|
|
223
|
+
- [Contributing Guide](/CONTRIBUTING.md)
|
|
224
|
+
- [Roadmap](/ROADMAP.md)
|
|
225
|
+
- [Changelog](/CHANGELOG.md)
|
|
226
|
+
- [Report security vulnerabilities](/SECURITY.md)
|
|
227
|
+
- [Open an Issue](https://github.com/open-nudge/pynudger/issues)
|
|
228
|
+
|
|
229
|
+
## Legal
|
|
230
|
+
|
|
231
|
+
- This project is licensed under the _Apache 2.0 License_ - see
|
|
232
|
+
the [LICENSE](/LICENSE.md) file for details.
|
|
233
|
+
- This project is copyrighted by _open-nudge_ - the
|
|
234
|
+
appropriate copyright notice is included in each file.
|
|
235
|
+
|
|
236
|
+
<!-- mkdocs remove end -->
|
|
237
|
+
|
|
238
|
+
<!-- md-dead-link-check: on -->
|