-
Notifications
You must be signed in to change notification settings - Fork 182
/
pyproject.toml
138 lines (126 loc) · 3.31 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
[project]
requires-python = ">= 3.11"
[tool.coverage.report]
omit = [
"*/migrations/*.py",
"*wsgi.py",
"env/*",
"manage.py",
"node_modules/*",
"privaterelay/locales/*",
]
exclude_also = [
# Skip code that is only evaluated by static type checkers like pyright and mypy
"if TYPE_CHECKING:",
# Skip abstract methods
"raise NotImplementedError",
]
[tool.coverage.run]
relative_files = true
source = ["."]
[tool.django-stubs]
django_settings_module = "privaterelay.settings"
[tool.mypy]
exclude = "env"
mypy_path = "$MYPY_CONFIG_FILE_DIR/mypy_stubs"
plugins = ["mypy_django_plugin.main"]
python_version = "3.11"
show_error_codes = true
strict = true
# Disable these strict checks
# Order is the recommended enabling order, from highest to lowest priority,
# from mypy doc "Using mypy with an existing codebase"
disallow_subclassing_any = false
disallow_any_generics = false
disallow_untyped_calls = false
disallow_untyped_defs = false
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"allauth.account.*",
"allauth.core.*",
"allauth.socialaccount.*",
"boto3",
"botocore.config",
"botocore.exceptions",
"codetiming",
"csp.constants",
"csp.middleware",
"debug_toolbar",
"dj_database_url",
"django_filters.*",
"django_ftl",
"django_ftl.bundles",
"google.*",
"googlecloudprofiler",
"ipware",
"jwcrypto",
"jwcrypto.jwe",
"jwcrypto.jwk",
"markus",
"markus.main",
"markus.testing",
"markus.utils",
"oauthlib.oauth2.rfc6749.errors",
"requests_oauthlib",
"silk",
"twilio.base.exceptions",
"twilio.base.instance_resource",
"twilio.request_validator",
"twilio.rest",
"vobject",
"waffle",
"waffle.models",
"waffle.testutils",
"whitenoise.middleware",
"whitenoise.storage",
]
[tool.paul-mclendahand]
# Creates a PR that combines several dependabot PRs
# https://github.com/willkg/paul-mclendahand
github_project = "fx-private-relay"
github_user = "mozilla"
main_branch = "main"
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "privaterelay.settings"
python_files = "tests.py test_*.py *_tests.py"
norecursedirs = ".git .local extension frontend node_modules"
testpaths = ["api", "emails", "phones", "privaterelay"]
[tool.ruff.lint]
select = [
"S", # flake8-bandit
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"W", # pycodestyle warnings
]
extend-safe-fixes = [
# E711 Comparison to `None` should be `cond is / is not None`
# Changes '== None' to 'is None'
"E711",
# E712 Avoid equality comparisons to True / False
# Changes '== True' to 'is True'
"E712",
# UP031 Use format specifiers instead of percent format
"UP031",
]
[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
"django",
"third-party",
"first-party",
"local-folder",
]
[tool.ruff.lint.isort.sections]
"django" = ["django"]
[tool.ruff.lint.per-file-ignores]
# Ignore line length in generated file
"privaterelay/glean/server_events.py" = ["E501"]
# S101: Allow assert in tests, since it is correct usage for pytest
# S105: Allow hardcoded passwords in tests
# S311: Allow pseudo-random generators in tests
"**/tests/*_tests.py" = ["S101", "S105", "S311"]
"**/tests/utils.py" = ["S101", "S311"]