-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
140 lines (126 loc) · 3.62 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com
#
# SPDX-License-Identifier: AGPL-3.0-only
# Global options for static analysis:
[tool.mypy]
python_version = "3.8"
plugins = [
"returns.contrib.mypy.returns_plugin",
"pydantic.mypy",
]
# follow_imports = "silent"
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
no_implicit_reexport = true
warn_return_any = true
warn_unused_configs = true
# This at false, otherwise it will flag every generic obj like dict
disallow_any_generics = false
# for strict mypy: (this is the tricky one :-))
disallow_untyped_defs = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
# Per-module options:
[[tool.mypy.overrides]]
module = [
"pypdfium2"
]
ignore_missing_imports = true
[tool.ruff]
# Always generate Python 3.8-compatible code.
target-version = "py38"
# https://beta.ruff.rs/docs/rules/
select = [
"E", # pycodestyle (`E`)
"F", # Pyflakes (`F`)
"C901", # McCabe complexity (`C901`)
"W", # pycodestyle warnings (`W`)
"B", # flake8-bugbear (`B`)
"I001", # isort (sort import for type and alphanumerically),
"N", # pep8 naming
"UP", # pyupgrade
"ANN", # flake8 annotations
"ASYNC",# flake8 async
"S", # bandit
"FBT", # boolean trap
"A", # flake8 shadowing builtins
"COM", # missing or extra commas
"C4", # flake8 comprehension
"EM", # better error messages check
"G", # logging format
"INP", # remove implicit namespace package
"PIE", # flake8 pie, unecessary statements or duplicates
"T20", # removes prints
"PYI", # Specializations for type hinting stub files
"Q", # quotes lint
"RSE", # raise linter uneccessary parenthesis
"RET", # return statement
"SLF", # accessing private members
"SIM", # simplifies code
"TCH", # type check
"ARG", # unused arguments
"PTH", # use Path insead of os library
"TD", # rules on how to write todos
"FIX", # for fixmes
"ERA", # removes commented code
"PLE",
"PLR",
"PLW",
"TRY", # prevents error handling antipatterns
"FLY",
"PERF", # check for performance antipatterns
"RUF", # ruff rules
]
ignore = [
"ANN401", # dynamically typed expression
"PLR0913", # too many arguments to function call T0REMOVE
"B008", # do not perform function calls Depends
"G004", # logging using f string (should be refactored)
"TRY400", # logging exception with other levels
"FBT001", # boolean positional arg in function
"FBT002", # boolean values in function
"A002", # it would break API fixing, shadowing builtin
"A003", # it would break API fiing, shadowing builtin
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
fix = true
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"gunicorn.conf.py",
"tests"
]
per-file-ignores = {}
# Same as Black.
line-length = 88
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.pep8-naming]
# Allow Pydantic's `@field_validator` decorator to trigger class method treatment.
classmethod-decorators = ["pydantic.field_validator"]