4
4
#
5
5
# This file follows the standards in Google Python Style Guide
6
6
# https://google.github.io/styleguide/pyguide.html
7
- #
8
- # The settings below are for the IDE configuration, and are optional.
9
- # {
10
- # "editor.formatOnSave": true,
11
- # "[python]": {
12
- # "editor.defaultFormatter": "charliermarsh.ruff",
13
- # "editor.formatOnSave": true,
14
- # "editor.codeActionsOnSave": {
15
- # "source.organizeImports": "true"
16
- # },
17
- # },
18
- # "ruff.importStrategy": "fromEnvironment",
19
- # }
7
+ #
20
8
21
9
line-length = 80 # Google Style Guide §3.2: 80 columns
22
10
indent-width = 4 # Google Style Guide §3.4: 4 spaces
23
11
24
- target-version = " py312 " # Minimum Python version
12
+ target-version = " py310 " # Minimum Python version
25
13
26
14
[lint ]
27
15
ignore = [
28
- " COM812" ,
29
- " FBT001" ,
30
- " FBT002" ,
31
- " D203" ,
32
- " D213" ,
33
- " ANN001" ,
34
- " ANN201" ,
35
- " ANN204" ,
36
- " D100" , # Ignore Missing docstring in public module (often desired at top level __init__.py)
37
- " D102" , # Ignore return type annotation in public method
38
- " D104" , # Ignore Missing docstring in public package (often desired at top level __init__.py)
39
- " D107" , # Ignore Missing docstring in __init__ (use class docstring)
40
- " TD002" , # Ignore Missing author in TODOs (often not required)
41
- " TD003" , # Ignore Missing issue link in TODOs (often not required/available)
42
- " T201" , # Ignore print presence
16
+ " COM812" , # Trailing comma missing.
17
+ " FBT001" , # Boolean positional arg in function definition
18
+ " FBT002" , # Boolean default value in function definition
19
+ " D203" , # 1 blank line required before class docstring (Google: 0)
20
+ " D213" , # Multi-line docstring summary should start at the second line (Google: first line)
21
+ " D100" , # Ignore Missing docstring in public module (often desired at top level __init__.py)
22
+ " D104" , # Ignore Missing docstring in public package (often desired at top level __init__.py)
23
+ " D107" , # Ignore Missing docstring in __init__ (use class docstring)
24
+ " TD002" , # Ignore Missing author in TODOs (often not required)
25
+ " TD003" , # Ignore Missing issue link in TODOs (often not required/available)
26
+ " T201" , # Ignore print presence
43
27
" RUF012" , # Ignore Mutable class attributes should be annotated with `typing.ClassVar`
44
- " RUF013" , # Ignore implicit optional
28
+ " E501" , # Ignore line length (handled by Ruff's dynamic line length)
29
+ " ANN002" ,
30
+ " ANN003" ,
31
+ " ANN401" ,
45
32
]
46
33
47
34
select = [
@@ -62,12 +49,14 @@ select = [
62
49
" PTH" ,# flake8-use-pathlib (use pathlib instead of os.path where possible)
63
50
" PL" , # Pylint rules ported to Ruff (PLC, PLE, PLR, PLW)
64
51
" PIE" ,# flake8-pie (misc code improvements, e.g., no-unnecessary-pass)
65
- " RUF" ,# Ruff-specific rules (e.g., RUF001-003 ambiguous unicode)
52
+ " RUF" ,# Ruff-specific rules (e.g., RUF001-003 ambiguous unicode, RUF013 implicit optional )
66
53
" RET" ,# flake8-return (consistency in return statements)
67
54
" SLF" ,# flake8-self (check for private member access via `self`)
68
55
" TID" ,# flake8-tidy-imports (relative imports, banned imports - configure if needed)
69
56
" YTT" ,# flake8-boolean-trap (checks for boolean positional arguments, truthiness tests - Google Style §3.10)
70
57
" TD" , # flake8-todos (check TODO format - Google Style §3.7)
58
+ " TCH" ,# flake8-type-checking (helps manage TYPE_CHECKING blocks and imports)
59
+ " PYI" ,# flake8-pyi (best practices for .pyi stub files, some rules are useful for .py too)
71
60
]
72
61
73
62
exclude = [
@@ -109,6 +98,7 @@ lines-between-types = 1
109
98
110
99
[lint .pydocstyle ]
111
100
convention = " google"
101
+ ignore-decorators = [" typing.overload" , " abc.abstractmethod" ]
112
102
113
103
[lint .flake8-annotations ]
114
104
mypy-init-return = true
@@ -127,7 +117,7 @@ docstring-quotes = "double"
127
117
inline-quotes = " single"
128
118
129
119
[lint .per-file-ignores ]
130
- "__init__.py" = [" F401" ] # Ignore unused imports in __init__.py
120
+ "__init__.py" = [" F401" , " D " , " ANN " ] # Ignore unused imports in __init__.py
131
121
"*_test.py" = [" D" , " ANN" ] # Ignore docstring and annotation issues in test files
132
122
"test_*.py" = [" D" , " ANN" ] # Ignore docstring and annotation issues in test files
133
123
0 commit comments