forked from aeecleclair/Hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
121 lines (110 loc) · 2.82 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
[tool.ruff]
# By default ruff also respect gitignore files
# Same as Black.
line-length = 88
indent-width = 4
target-version = "py311"
[tool.ruff.lint]
# Enable Pyflakes (`F`), pycodestyle (`E`, `W`), isort (`I`), pep8-naming (`N`), flake8-bugbear (`B`)
# T201: check for prints, C90: mccabe complexity
select = [
"F",
"E",
"W",
"I",
"T201",
"C90",
"DTZ",
"UP",
"ASYNC",
"S",
"B",
"A",
"COM",
"C4",
"ISC",
"ICN",
"INP",
"PIE",
"T20",
"PYI",
"PT",
"Q",
"SLF",
"SLOT",
"SIM",
"TCH",
"PTH",
"RUF",
] # "B", "N" to add later
ignore = [
"E203",
"E266",
"E501",
"F403",
"S104",
"B008",
"C401",
"ISC001",
"SIM102",
"SIM105",
"RUF012", # We may want to enable "Mutable class attributes should be annotated with `typing.ClassVar`"
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.per-file-ignores]
# Allow `assert` and hardcoded passwords for tests.
"tests/*" = ["S101", "S105", "S106", "ASYNC101"]
# Allow endpoints, tools and dependencies to raise `HTTPException` after catching an excetion without reraising (`from err`)
"**/endpoints_*" = ["B904"]
"**/cruds_*" = ["B904"] # TODO: find a better way to handle cruds errors
"app/utils/tools.py" = ["B904"]
"app/dependencies.py" = ["B904"]
# Migrations folder should not really be part of a Python package
"migrations/env.py" = ["INP001"]
# Allow raw SQL for migrations
"migrations/versions/*" = ["S608"]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 18.
max-complexity = 18
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.mypy]
python_version = "3.11"
plugins = ["pydantic.mypy"]
ignore_missing_imports = true
exclude = '''(?x)(
.git
| __pycache__
| .pytest_cache
| .venv
)'''
warn_unreachable = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
filterwarnings = "error"
[tool.coverage.run]
source_pkgs = ["app"]
omit = [
"main.py", # Main is just a wrapper and is not used during tests
"mailworker.py", # We don't use send mails during tests
"*matrix*", # We don't send logs to matrix during tests
]
concurrency = [
"thread",
"greenlet",
] # Tell the tool that we also use greenlet, because sqlalchemy does
[tool.coverage.report]
# Regexes for lines to exclude from consideration
# See https://coverage.readthedocs.io/en/latest/excluding.html#excluding for more info
exclude_also = []
skip_covered = true
show_missing = true