-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
256 lines (234 loc) · 8.71 KB
/
pyproject.toml
File metadata and controls
256 lines (234 loc) · 8.71 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
[project]
name = "ruff-sync"
version = "0.1.7.dev1"
description = "Synchronize Ruff linter configuration across projects"
keywords = ["ruff", "linter", "config", "synchronize", "python", "linting", "automation", "tomlkit", "pre-commit"]
authors = [
{ name = "Gabriel Gore", email = "gabriel59kg@gmail.com" }
]
license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Quality Assurance",
]
dependencies = [
"httpx>=0.27.0,<1.0.0",
"tomlkit>=0.12.3,<2.0.0",
"typing-extensions>=4.5.0",
]
[project.optional-dependencies]
tui = ["textual>=8.2.2"]
[project.urls]
Homepage = "https://github.com/Kilo59/ruff-sync"
Documentation = "https://kilo59.github.io/ruff-sync/"
Repository = "https://github.com/Kilo59/ruff-sync"
Issues = "https://github.com/Kilo59/ruff-sync/issues"
Changelog = "https://github.com/Kilo59/ruff-sync/releases"
[project.scripts]
ruff-sync = "ruff_sync:main"
ruff-inspect = "ruff_sync:inspect"
[dependency-groups]
dev = [
"coverage>=7.4.4",
"dirty-equals>=0.11",
"invoke>=2.2.0",
"mypy>=1.10.0",
"packaging>=26.0",
"pre-commit>=3.7.0",
"pyfakefs>=5.4.1",
"pytest>=8.0.0",
"pytest-asyncio>=0.23.5",
"pytest-codspeed>=4.3.0",
"pytest-icdiff>=0.9",
"pytest-textual-snapshot>=1.0.0",
"respx>=0.21.1",
"ruamel-yaml>=0.18.6",
"ruff>=0.15.0",
"textual>=8.2.2",
"wily>=1.25.0",
]
docs = [
"mkdocs>=1.6.1",
"mkdocs-gen-files>=0.6.0",
"mkdocs-literate-nav>=0.6.2",
"mkdocs-material>=9.7.5",
"mkdocstrings[python]>=1.0.3",
"mike>=2.1.2",
]
[tool.uv]
default-groups = ["dev"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/ruff_sync"]
[tool.mypy]
python_version = "3.10"
files = ["src", "tests/", "tasks.py", ".agents/"]
strict = true
warn_unused_configs = true
ignore_missing_imports = true
warn_redundant_casts = true
warn_unused_ignores = true
show_error_codes = true
implicit_reexport = false
disallow_any_generics = true
enable_error_code = ['ignore-without-code', 'explicit-override']
exclude = 'site/.*'
[[tool.mypy.overrides]]
module = "tests.*"
disable_error_code = ['type-arg', 'no-untyped-def']
[tool.ruff-sync]
upstream = "https://github.com/Kilo59/ruff-sync/"
to = "pyproject.toml"
exclude = [
"target-version",
"line-length",
"lint.per-file-ignores",
"lint.ignore",
"lint.flake8-tidy-imports.banned-api",
"lint.isort.required-imports",
]
[tool.ruff]
target-version = "py310"
line-length = 100
[tool.ruff.lint]
select = [
# https://docs.astral.sh/ruff/rules/#flake8-async-async
"ASYNC", # async rules
# https://beta.ruff.rs/docs/rules/#flake8-bugbear-b
"B", # bugbear - common python bugs & design issues
# https://beta.ruff.rs/docs/rules/#flake8-comprehensions-c4
# https://beta.ruff.rs/docs/rules/#mccabe-c90
"C", # Complexity (mccabe+) & comprehensions
# https://docs.astral.sh/ruff/rules/#pydocstyle-d
"D", # pydocstyle
# https://beta.ruff.rs/docs/rules/#flake8-datetimez-dtz
"DTZ", # flake8-datetimez-dtz - prevent use of tz naive datetimes
"EM", # flake8-errmsg - raw string literals in error messages
# https://beta.ruff.rs/docs/rules/#pyflakes-f
"F", # Pyflakes
# https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
"E", # pycodestyle
"W", # Warning
# https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"G", # logging-format - logging format string issues
# https://beta.ruff.rs/docs/rules/#isort-i
"I", # isort
# https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"ICN", # import-conventions
# https://docs.astral.sh/ruff/rules/#pep8-naming-n
"N", # pep8-naming
# https://docs.astral.sh/ruff/rules/#flake8-logging-log
"LOG", # logging - logging best practices
# https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"PERF", # perflint - performance related rules
# https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"PGH", # pygrep-hooks - hooks for pygrep
# https://beta.ruff.rs/docs/rules/#flake8-use-pathlib-pth
"PTH", # use-pathlib - use pathlib for os.path and glob operations
# https://beta.ruff.rs/docs/rules/#pylint-pl
"PL", # pylint
# https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
"FA", # future-annotations - enforce future annotations
# https://docs.astral.sh/ruff/rules/#refurb-furb
"FURB", # refurb - refactoring + modernization
# https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
"RUF",
# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"S", # bandit - security
# https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"SIM", # simplify - simplify code
# https://docs.astral.sh/ruff/rules/#flake8-slots-slot
"SLOT", # slots - enforce __slots__ usage
# https://beta.ruff.rs/docs/rules/#flake8-type-checking-tch
"TC", # flake8-type-checking-tch
# https://beta.ruff.rs/docs/rules/#flake8-tidy-imports-tid
"TID", # flake8-tidy-imports
# https://docs.astral.sh/ruff/rules/#tryceratops-try
"TRY", # tryceratops - exception handling
# https://docs.astral.sh/ruff/rules/#flake8-print-t20
"T20", # flake8-print
# https://beta.ruff.rs/docs/rules/#pyupgrade-up
"UP", # pyupgrade
]
ignore = [
# https://docs.astral.sh/ruff/rules/logging-f-string/
"G004", # f-string is performant enough
# https://docs.astral.sh/ruff/rules/raise-vanilla-args/
"TRY003", # overkill for such a small project
]
[tool.ruff.lint.per-file-ignores]
"src/ruff_sync/formatters.py" = ["T20"]
"tasks.py" = ["T20"]
"scripts/**/*.py" = ["T20", "ASYNC"]
"tests/**/*.py" = [
"T20", # allow print in tests
"D100", # missing docstring in module
"D101", # missing docstring in class
"D103", # missing docstring in function
"D400", # first line should end with a period
"D401", # first line of docstring should be in imperative mood
"D415", # first line should end with a period, question mark, or exclamation point
"D200", # one-line docstring should fit on one line
"D212", # multi-line docstring summary should start at the first line
"D205", # 1 blank line required between summary line and description
"S101", # assert statements should be used in tests
"S311", # random numbers in tests do not need to be cryptographically secure
"S603", # subprocess without shell
"S607", # protects against modification of PATH
"S608", # don't care about sql injection in tests
"S105", # hard-code passwords in tests should be fake
"S106", # hard-code passwords in tests should be fake
"PLR2004", # magic values in test comparison is less of a concern
"PLR0913", # too many arguments in test functions
"PLC0415", # lazy imports needed for some tests and fixture setup
"FBT001", # boolean typed positional arguments common in parametrized tests
"FBT003", # Boolean positional value in test code is common and less of a concern
"TRY003", # don't care about long exception messages in tests
"PLW1510", # subprocess check not needed in tests
"PT013", # pytest import style, prevents importing param and or types in from style
"TC002", # Move third-party import into type-checking block
"TID251", # allow cast in tests
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 6
[tool.ruff.format]
# Format code snippets in docstrings.
docstring-code-format = true
# Wrap docstring code snippets at the project line length.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"unittest.mock".msg = "Prefer dedicated libraries to mock at external dependencies, such as `httpx` or `pyfakefs`."
"typing.cast".msg = "Please fix the underlying type issues instead of using typing.cast."
[tool.ruff.lint.flake8-import-conventions]
# Declare the banned `from` imports.
banned-from = ["pathlib", "datetime"]
[tool.ruff.lint.flake8-import-conventions.aliases]
# Declare the default aliases.
datetime = "dt"
"pprint.pprint" = "pp"
"pprint.pformat" = "pf"
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
[tool.coverage.run]
include = ["src/ruff_sync/*.py"]
[tool.pytest]
log_level = "INFO"
markers = [
"benchmark: marks performance benchmarks (run separately for CodSpeed)",
]