forked from zulip/zulip-terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
157 lines (143 loc) · 4.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
[tool.black]
# Default line-length, but use explicit value here since used for isort & ruff
line-length = 88
target-version = ['py37']
[tool.coverage.run]
branch = true
# omit = ...
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self.debug",
# Don't complain if tests don't hit defensive assertion code
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code is not run:
"if 0:",
"if __name__ == .__main__.:",
]
precision = 1
skip_covered = true
show_missing = true
[tool.isort]
py_version = 37
# Use black for the default settings (with adjustments listed below)
profile = "black"
# For compatibility with 'black' we'd want to set this consistently
line_length = 88
atomic = true
# This is compatible with black, but we could remove it
lines_after_imports = 2
[tool.mypy]
python_version = 3.7
# Logistics of what code to check and how to handle the data.
# mypy_path = stubs/
scripts_are_modules = true
show_traceback = true
cache_dir = ".mypy_cache"
# Options to make the checking stricter, as would be mypy --strict
# (in order of mypy --help docs for --strict)
warn_unused_configs = true
disallow_any_generics = true
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = false
no_implicit_reexport = false
strict_equality = true
# These are now defaults and we could remove them
warn_no_return = true
strict_optional = true
# If a library is typed, that's fine, otherwise don't worry
ignore_missing_imports = true
[[tool.mypy.overrides]]
# Tests remaining to be typed
module = [
"tests.model.test_model",
"tests.ui.test_ui_tools",
"tests.ui_tools.test_messages",
]
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = false
[tool.pytest.ini_options]
minversion = "6.0"
xfail_strict = true
addopts = "-rxXs --cov=zulipterminal --no-cov-on-fail"
filterwarnings = [
# distutils: imp module is deprecated in favor of importlib
# * python3.6/3.7/3.8
"ignore::DeprecationWarning:distutils.*:",
# bs4: ABCs must be imported from collections.abc, not collections, from python3.9
# * python 3.7/3.8
"ignore::DeprecationWarning:bs4.*:",
]
[tool.ruff]
line-length = 88
target-version = "py37"
exclude = [
".git",
"__pycache__",
"build",
"dist",
"zt_venv",
]
ignore = [
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in classmethod
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"B006", # Do not use mutable data structures for argument defaults
"B007", # Loop control variable not used within the loop body [informative!]
"C408", # Unnecessary 'dict' call (rewrite as a literal)
"N818", # Exception name should be named with an Error suffix
"SIM108", # Prefer ternary operator over if-else (as per zulip/zulip)
"UP015", # Unnecessary open mode parameters [informative?]
]
select = [
"ANN", # Annotations
"B", # Bugbear
"C4", # Comprehensions
"E", # Error (pycodestyle)
"F", # pyFlakes
"G", # loGging
"N", # Naming
"PGH", # PyGrep Hooks
"PIE", # pie (miscellaneous)
"PLC", # pylint convention
"PLE", # pylint error
"RSE", # RaiSE
"PLW", # pylint warning
"RUF100", # Checks noqa rules are used
"SIM", # SIMplify
"T20", # prinT present
"W", # Warnings (pycodestyle)
"UP", # pyUPgrade
"YTT", # Year TwentyTwenty (flake8-2020), sys.version checks
]
[tool.ruff.per-file-ignores]
# ANN: We don't consider this worth typing
"setup.py" = ["ANN"]
# ANN: These test files are not yet typed
"tests/model/test_model.py" = ["ANN"]
"tests/ui/test_ui_tools.py" = ["ANN"]
"tests/ui_tools/test_messages.py" = ["ANN"]
# ANN: This tool is an old variation from zulip/zulip and is only updated where necessary
"tools/lister.py" = ["ANN"]
# E501: Ignore length in tools for now (and otherwise where noqa specified)
# T20: Expect print output from CLI from tools
"tools/*" = ["E501", "T20"]
# T20: Expect print output from CLI from run.py
"zulipterminal/cli/run.py" = ["T20"]
# N802: Allow upper-case in test function names, eg. for commands, such as test_keypress_ENTER
# N803: Allow upper-case in test function argument names, eg. ZFL, API
# N806: Allow upper-case in test function variables
"tests/*" = ["N802", "N803", "N806"]