| 1 |
[build-system] |
| 2 |
requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.2"] |
| 3 |
build-backend = "setuptools.build_meta" |
| 4 |
|
| 5 |
[project] |
| 6 |
name = "rstcheck-core" |
| 7 |
requires-python = ">=3.8" |
| 8 |
authors = [ |
| 9 |
{ name = "Steven Myint", email = "[email protected]" }, |
| 10 |
] |
| 11 |
maintainers = [ |
| 12 |
{ name = "Christian Riedel", email = "[email protected]" }, |
| 13 |
] |
| 14 |
description = "Checks syntax of reStructuredText and code blocks nested within it" |
| 15 |
readme = "README.rst" |
| 16 |
license = { text = "MIT" } |
| 17 |
classifiers = [ |
| 18 |
"Topic :: Software Development :: Quality Assurance", |
| 19 |
] |
| 20 |
keywords = ["restructuredtext", "rst", "linter", "static-analysis"] |
| 21 |
dynamic = ["version"] |
| 22 |
|
| 23 |
dependencies = [ |
| 24 |
"docutils >=0.7", |
| 25 |
"pydantic >=2", |
| 26 |
"importlib-metadata >=1.6; python_version<='3.8'", |
| 27 |
"typing-extensions >=3.7.4; python_version<='3.8'", |
| 28 |
] |
| 29 |
|
| 30 |
[project.optional-dependencies] |
| 31 |
sphinx = ["sphinx >=5.0"] |
| 32 |
toml = ["tomli >=2.0; python_version<='3.10'"] |
| 33 |
yaml = ["pyyaml >= 6.0.0"] |
| 34 |
testing = [ |
| 35 |
"pytest >=7.2", |
| 36 |
"pytest-cov >=3.0", |
| 37 |
"coverage[toml] >=6.0", |
| 38 |
"coverage-conditional-plugin >=0.5", |
| 39 |
"pytest-sugar >=0.9.5", |
| 40 |
"pytest-randomly >=3.0", |
| 41 |
"pytest-mock >=3.7", |
| 42 |
] |
| 43 |
docs = [ |
| 44 |
"sphinx >=5.0, !=7.2.5", |
| 45 |
"m2r2 >=0.3.2", |
| 46 |
"sphinx-rtd-theme >=1.2", |
| 47 |
"sphinx-autodoc-typehints >=1.15", |
| 48 |
"sphinxcontrib-apidoc >=0.3", |
| 49 |
"sphinxcontrib-spelling >=7.3", |
| 50 |
"sphinx-autobuild >=2021.3.14", |
| 51 |
] |
| 52 |
type-check = [ |
| 53 |
"mypy >=1.0", |
| 54 |
"types-docutils >=0.18", |
| 55 |
"types-PyYAML >=6.0.0", |
| 56 |
] |
| 57 |
dev = [ |
| 58 |
"rstcheck-core[sphinx,toml,testing,docs,type-check,yaml]", |
| 59 |
"tox >=3.15", |
| 60 |
] |
| 61 |
|
| 62 |
[project.urls] |
| 63 |
Documentation = "https://rstcheck-core.readthedocs.io/en/latest/" |
| 64 |
Repository = "https://github.com/rstcheck/rstcheck-core" |
| 65 |
Changelog = "https://github.com/rstcheck/rstcheck-core/blob/main/CHANGELOG.md" |
| 66 |
|
| 67 |
[tool.setuptools_scm] |
| 68 |
write_to = "src/rstcheck_core/__version__.py" |
| 69 |
|
| 70 |
|
| 71 |
# -- BLACK CONFIG --------------------------------------------------------------------- |
| 72 |
[tool.black] |
| 73 |
line-length = 100 |
| 74 |
exclude = "venv/" |
| 75 |
include = '\.pyi?$' # single quotes needed |
| 76 |
|
| 77 |
# -- MYPY CONFIG ---------------------------------------------------------------------- |
| 78 |
[tool.mypy] |
| 79 |
show_error_codes = true |
| 80 |
strict_optional = true |
| 81 |
warn_unused_ignores = true |
| 82 |
warn_redundant_casts = true |
| 83 |
warn_return_any = true |
| 84 |
warn_unreachable = true |
| 85 |
disallow_any_generics = true |
| 86 |
check_untyped_defs = true |
| 87 |
implicit_reexport = false |
| 88 |
python_version = "3.11" # CHANGE ME |
| 89 |
plugins = "pydantic.mypy" |
| 90 |
|
| 91 |
[tool.pydantic-mypy] |
| 92 |
init_forbid_extra = true |
| 93 |
init_typed = false |
| 94 |
warn_required_dynamic_aliases = true |
| 95 |
warn_untyped_fields = true |
| 96 |
|
| 97 |
|
| 98 |
# -- RUFF CONFIG ---------------------------------------------------------------------- |
| 99 |
[tool.ruff] |
| 100 |
target-version = "py311" |
| 101 |
line-length = 100 |
| 102 |
output-format = "grouped" |
| 103 |
show-fixes = true |
| 104 |
show-source = true |
| 105 |
task-tags = ["TODO", "FIXME", "XXX", "NOTE", "BUG", "HACK", "CHANGE ME"] |
| 106 |
extend-exclude = [ |
| 107 |
"*venv*/", |
| 108 |
"*.bak.*", |
| 109 |
] |
| 110 |
src = ["src", "tests"] |
| 111 |
|
| 112 |
unfixable = ["ERA001"] |
| 113 |
|
| 114 |
select = [ |
| 115 |
"A", # flake8-builtins |
| 116 |
"AIR", # Airflow |
| 117 |
"ANN", # flake8-annotations |
| 118 |
"ARG", # flake8-unused-arguments |
| 119 |
"ASYNC", # flake8-async |
| 120 |
"B", # flake8-bugbear |
| 121 |
"BLE", # flake8-blind-except |
| 122 |
"C4", # flake8-comprehensions |
| 123 |
"C90", # mccabe |
| 124 |
# "COM", # flake8-commas # black does that |
| 125 |
"D", # pydocstyle |
| 126 |
"DJ", # flake8-django |
| 127 |
"DTZ", # flake8-datetimez |
| 128 |
"E", # pycodestyle |
| 129 |
"EM", # flake8-errmsg |
| 130 |
"ERA", # flake8-eradicate |
| 131 |
"EXE", # flake8-executable |
| 132 |
"F", # pyflakes |
| 133 |
"FA", # flake8-future-annotations |
| 134 |
"FBT", # flake8-boolean-trap |
| 135 |
# "FIX", # flake8-fixme # custom pre-commit hook does with RegEx |
| 136 |
"FLY", # flynt |
| 137 |
"G", # flake8-logging-format |
| 138 |
"I", # isort |
| 139 |
"ICN", # flake8-import-conventions |
| 140 |
"INP", # flake8-no-pep420 |
| 141 |
"INT", # flake8-gettext |
| 142 |
"ISC", # flake8-implicit-str-concat |
| 143 |
"N", # pep8-naming |
| 144 |
"NPY", # NumPy-specific rules |
| 145 |
"PD", # flake8-vet |
| 146 |
"PERF", # Perflint |
| 147 |
"PGH", # pygrep-hooks |
| 148 |
"PIE", # flake8-pie |
| 149 |
"PLC", # Pylint - Convention |
| 150 |
"PLE", # Pylint - Error |
| 151 |
"PLR", # Pylint - Refactor |
| 152 |
"PLW", # Pylint - Warning |
| 153 |
"PT", # flake8-pytest-style |
| 154 |
"PTH", # flake8-use-pathlib |
| 155 |
"PYI", # flake8-pyi |
| 156 |
"Q", # flake8-quotes |
| 157 |
"RET", # flake8-return |
| 158 |
"RUF", # Ruff-specific rules |
| 159 |
"RSE", # flake8-raise |
| 160 |
"S", # flake8-bandit |
| 161 |
"SLF", # flake8-self |
| 162 |
"SLOT", # flake8-slots |
| 163 |
"SIM", # flake8-simplify |
| 164 |
# "T10", # flake8-debugger # pre-commit hook does that |
| 165 |
"T20", # flake8-print |
| 166 |
"TCH", # flake8-type-checking |
| 167 |
# "TD", # flake8-todo |
| 168 |
"TID", # flake8-tidy-imports |
| 169 |
"TRY", # tryceratops |
| 170 |
"UP", # pyupgrade |
| 171 |
"W", # pycodestyle |
| 172 |
"YTT", # flake8-2020 |
| 173 |
] |
| 174 |
|
| 175 |
ignore = [ |
| 176 |
# deactivate because unwanted |
| 177 |
"ANN101", # type self |
| 178 |
"ANN102", # type cls |
| 179 |
"E501", # line length |
| 180 |
"PT011", # Use match for specific exceptions in pytest.raises |
| 181 |
] |
| 182 |
|
| 183 |
[tool.ruff.per-file-ignores] |
| 184 |
"**/tests/**" = [ |
| 185 |
"ARG", # unused arguments |
| 186 |
"PLR0913", # Too many arguments to function call |
| 187 |
"PLR2004", # Magic value comparison |
| 188 |
"S101", # assert used |
| 189 |
"SLF001", # Private member accessed |
| 190 |
] |
| 191 |
"**/tests/**/*_test.py" = [ |
| 192 |
"FBT001", # Boolean positional arg in function definition |
| 193 |
] |
| 194 |
"__init__.py" = [ |
| 195 |
"D104", # Missing docstring in public package |
| 196 |
"PLC0414", # useless-import-alias |
| 197 |
] |
| 198 |
"**/testing/examples/**" = [ |
| 199 |
"ERA001", # commented out code |
| 200 |
] |
| 201 |
"docs/source/conf.py" = [ |
| 202 |
"INP001", # implicit namespace |
| 203 |
] |
| 204 |
"__version__.py" = ["ALL"] |
| 205 |
|
| 206 |
[tool.ruff.flake8-annotations] |
| 207 |
suppress-dummy-args = true |
| 208 |
|
| 209 |
[tool.ruff.flake8-builtins] |
| 210 |
builtins-ignorelist = [ |
| 211 |
"id", |
| 212 |
] |
| 213 |
|
| 214 |
[tool.ruff.flake8-import-conventions.extend-aliases] |
| 215 |
"typing" = "t" |
| 216 |
|
| 217 |
[tool.ruff.flake8-pytest-style] |
| 218 |
fixture-parentheses = false |
| 219 |
mark-parentheses = false |
| 220 |
|
| 221 |
[tool.ruff.flake8-type-checking] |
| 222 |
runtime-evaluated-base-classes = [ |
| 223 |
"pydantic.BaseModel", |
| 224 |
] |
| 225 |
|
| 226 |
[tool.ruff.isort] |
| 227 |
combine-as-imports = true |
| 228 |
required-imports = [ |
| 229 |
"from __future__ import annotations", |
| 230 |
] |
| 231 |
|
| 232 |
[tool.ruff.mccabe] |
| 233 |
max-complexity = 20 |
| 234 |
|
| 235 |
[tool.ruff.pep8-naming] |
| 236 |
classmethod-decorators = [ |
| 237 |
"pydantic.field_validator", |
| 238 |
] |
| 239 |
staticmethod-decorators = [] |
| 240 |
|
| 241 |
[tool.ruff.pycodestyle] |
| 242 |
ignore-overlong-task-comments = true |
| 243 |
max-doc-length = 100 |
| 244 |
|
| 245 |
[tool.ruff.pydocstyle] |
| 246 |
convention = "pep257" |
| 247 |
ignore-decorators = [ |
| 248 |
"typing.overload", |
| 249 |
] |
| 250 |
property-decorators = [] |
| 251 |
|
| 252 |
[tool.ruff.pylint] |
| 253 |
max-args = 6 |
| 254 |
|
| 255 |
|
| 256 |
# -- PYTEST CONFIG -------------------------------------------------------------------- |
| 257 |
[tool.pytest.ini_options] |
| 258 |
addopts = "-ra --showlocals" |
| 259 |
|
| 260 |
|
| 261 |
# -- COVERAGE CONFIG ------------------------------------------------------------------ |
| 262 |
[tool.coverage] |
| 263 |
[tool.coverage.run] |
| 264 |
plugins = ["coverage_conditional_plugin"] |
| 265 |
branch = true |
| 266 |
parallel = true |
| 267 |
context = "static-context" |
| 268 |
omit = [ |
| 269 |
"tests/*", |
| 270 |
] |
| 271 |
|
| 272 |
[tool.coverage.paths] |
| 273 |
tox_combine = [ |
| 274 |
"src/rstcheck_core", |
| 275 |
"*/.tox/*/lib/python*/site-packages/rstcheck_core", |
| 276 |
"*/.tox/pypy*/site-packages/rstcheck_core", |
| 277 |
"*/.tox\\*\\Lib\\site-packages\\rstcheck_core", |
| 278 |
] |
| 279 |
local_combine = [ |
| 280 |
"src/rstcheck_core", |
| 281 |
"*/.venv/lib/python*/site-packages/rstcheck_core", |
| 282 |
"*/.venv\\*\\Lib\\site-packages\\rstcheck_core", |
| 283 |
"*/src/rstcheck_core", |
| 284 |
"*\\src\\rstcheck_core", |
| 285 |
] |
| 286 |
|
| 287 |
[tool.coverage.report] |
| 288 |
show_missing = true |
| 289 |
exclude_lines = [ |
| 290 |
"# pragma: no cover", |
| 291 |
"if __name__ == ['\"]__main__['\"]:", |
| 292 |
"def __str__", |
| 293 |
"def __repr__", |
| 294 |
"if self.debug:", |
| 295 |
"if settings.DEBUG", |
| 296 |
"if 0:", |
| 297 |
"if False:", |
| 298 |
"if TYPE_CHECKING:", |
| 299 |
"if MYPY:", |
| 300 |
] |
| 301 |
|
| 302 |
[tool.coverage.html] |
| 303 |
show_contexts = true |
| 304 |
|
| 305 |
[tool.coverage.coverage_conditional_plugin.rules] |
| 306 |
# use with: # pragma: <KEY> |
| 307 |
py-gte-310 = "sys_version_info >= (3, 10)" |