-
Notifications
You must be signed in to change notification settings - Fork 439
/
Copy pathpyproject.toml
130 lines (118 loc) · 5.81 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
[tool.pytest.ini_options]
addopts = "-q"
filterwarnings = [
"error", # Fail the tests if there are any warnings.
"ignore:^find_module\\(\\) is deprecated and slated for removal in Python 3.12; use find_spec\\(\\) instead$:DeprecationWarning:importlib",
"ignore:^FileFinder.find_loader\\(\\) is deprecated and slated for removal in Python 3.12; use find_spec\\(\\) instead$:DeprecationWarning:importlib",
"ignore:^pkg_resources is deprecated as an API:DeprecationWarning:pkg_resources",
"ignore:^pkg_resources is deprecated as an API:DeprecationWarning:pyramid",
"ignore:^Deprecated call to .pkg_resources\\.declare_namespace\\('.*'\\).\\.:DeprecationWarning:pkg_resources",
"ignore:^'cgi' is deprecated and slated for removal in Python 3\\.13$:DeprecationWarning:webob",
"ignore:^datetime\\.datetime\\.utcnow\\(\\) is deprecated and scheduled for removal in a future version\\.:DeprecationWarning",
"ignore:^pkg_resources is deprecated as an API:DeprecationWarning:deform",
"ignore:^The behavior of AcceptLanguageValidHeader\\.__iter__ is currently maintained for backward compatibility, but will change in the future.$:DeprecationWarning:webob.acceptparse",
"ignore:^Use of \\.\\. or absolute path in a resource path is not allowed and will raise exceptions in a future release\\.$:DeprecationWarning:pkg_resources",
"ignore:^Use of \\.\\. or absolute path in a resource path is not allowed and will raise exceptions in a future release\\.$:DeprecationWarning:pyramid",
# https://foss.heptapod.net/python-libs/passlib/-/issues/148
"ignore:^'crypt' is deprecated and slated for removal in Python 3.13:DeprecationWarning:passlib",
# Usage of deprecated method of urllib3 within the elasticsearch library
"ignore:^HTTPResponse.getheaders\\(\\) is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.$:DeprecationWarning:elasticsearch",
]
[tool.ruff]
target-version = "py311"
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN", # flake8-annotations (checks for absence of type annotations on functions)
"CPY", # flake8-copyright (checks for missing copyright notices)
"COM", # flake8-commas (we use a code formatter so we don't need a linter to check this)
"D100","D101","D102","D103","D104","D105","D106","D107", # Missing docstrings.
"D202", # "No blank lines allowed after function docstring" conflicts with the Ruff code formatter.
# "Multi-line docstring summary should start at the first line" (D212)
# and "Multi-line docstring summary should start at the second line" (D213).
# These two rules conflict with each other so you have to disable one of them.
# How about we disable them both? PEP 257 says either approach is okay:
#
# > The summary line may be on the same line as the opening quotes or on
# > the next line.
# >
# > https://peps.python.org/pep-0257/#multi-line-docstrings
"D212", "D213",
"D203", # incorrect-blank-line-before-class. Incompatible with `no-blank-line-before-class` (D211)
"E501", # line-too-long (we use the code formatter so we don't need the linter to check line lengths for us).
"PLR2004", # "Magic value used in comparison", this mostly triggers false-positives related to HTTP status codes.
"PLR6301", # Method could be a function/classmethod/static method (doesn't use self)
"RET501", # Do not explicitly return None if it's the only possible return value.
"RET504", # Unnecessary assignment before return statement.
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
# Just disable name style checking for the tests, because we
# frequently use lots of argument names that don't conform.
# For example we frequently create pytest fixtures that aren't named in
# snake_case, such as a fixture that returns a mock of the FooBar class would
# be named FooBar in CamelCase.
"N",
"PLR0913", # Too many arguments. Tests often have lots of arguments.
"PLR0917", # Too many positional arguments. Tests often have lots of arguments.
"PLR0904", # Too many public methods. Test classes often have lots of test methods.
"S101", # Use of `assert` detected.
"PT006", # Enforces a consistent style for the type of the `argnames` parameter to
# pytest.mark.parametrize. We have too many pre-existing violations of
# this.
"PT007", # Enforces a consistent style for the type of the `argvalues` parameter to
# pytest.mark.parametrize. We have too many pre-existing violations of
# this.
]
"__init__.py" = [
"F401", # Ignore unused import errors on __init__ files to avoid having to add either a noqa stament or an __all__ declaration.
]
"h/migrations/*" = [
"INP001",
]
"bin/*" = [
"INP001",
]
[tool.coverage.run]
branch = true
parallel = true
source = ["h", "tests/unit"]
omit = [
"*/h/__main__.py",
"*/h/scripts/init_db.py",
"h/cli/*",
"h/pshell.py",
"h/scripts/init_elasticsearch.py",
]
[tool.coverage.paths]
source = ["src", ".tox/*tests/lib/python*/site-packages"]
[tool.coverage.report]
show_missing = true
precision = 2
fail_under = 100.00
skip_covered = true
exclude_also = [
# `if TYPE_CHECKING:` blocks are only executed while running mypy.
"if TYPE_CHECKING:",
]
[tool.mypy]
allow_untyped_globals = true
error_summary = false
pretty = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
disable_error_code = [
# https://mypy.readthedocs.io/en/stable/error_code_list.html#code-import-untyped
"import-untyped",
]
[[tool.mypy.overrides]]
module = [
# Don't try to typecheck the tests for now.
"tests.*",
# Disable type-checking in h (by ignoring all files) for now.
# This is just to get `make typecheck` passing.
# In future we should remove this and fix h's type-checking errors.
"h.*",
]
ignore_errors = true