[build-system] requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" [project] name = "rstcheck-core" requires-python = ">=3.8" authors = [ { name = "Steven Myint", email = "git@stevenmyint.com" }, ] maintainers = [ { name = "Christian Riedel", email = "cielquan@protonmail.com" }, ] description = "Checks syntax of reStructuredText and code blocks nested within it" readme = "README.rst" license = { text = "MIT" } classifiers = [ "Topic :: Software Development :: Quality Assurance", ] keywords = ["restructuredtext", "rst", "linter", "static-analysis"] dynamic = ["version"] dependencies = [ "docutils >=0.7", "pydantic >=2", ] [project.optional-dependencies] sphinx = ["sphinx >=5.0"] toml = ["tomli >=2.0; python_version<='3.10'"] yaml = ["pyyaml >= 6.0.0"] testing = [ "pytest >=7.2", "pytest-cov >=3.0", "coverage[toml] >=6.0", "coverage-conditional-plugin >=0.5", "pytest-sugar >=0.9.5", "pytest-randomly >=3.0", "pytest-mock >=3.7", ] docs = [ "sphinx >=5.0, !=7.2.5", "m2r2 >=0.3.2", "sphinx-rtd-theme >=1.2", "sphinx-autodoc-typehints >=1.15", "sphinxcontrib-apidoc >=0.3", "sphinxcontrib-spelling >=7.3", "sphinx-autobuild >=2021.3.14", ] type-check = [ "mypy >=1.0", "types-docutils >=0.18", "types-PyYAML >=6.0.0", ] dev = [ "rstcheck-core[sphinx,toml,testing,docs,type-check,yaml]", "tox >=3.15", ] [project.urls] Documentation = "https://rstcheck-core.readthedocs.io/en/latest/" Repository = "https://github.com/rstcheck/rstcheck-core" Changelog = "https://github.com/rstcheck/rstcheck-core/blob/main/CHANGELOG.md" [tool.setuptools_scm] write_to = "src/rstcheck_core/__version__.py" # -- BLACK CONFIG --------------------------------------------------------------------- [tool.black] line-length = 100 exclude = "venv/" include = '\.pyi?$' # single quotes needed # -- MYPY CONFIG ---------------------------------------------------------------------- [tool.mypy] show_error_codes = true strict_optional = true warn_unused_ignores = true warn_redundant_casts = true warn_return_any = true warn_unreachable = true disallow_any_generics = true check_untyped_defs = true implicit_reexport = false python_version = "3.11" # CHANGE ME plugins = "pydantic.mypy" [tool.pydantic-mypy] init_forbid_extra = true init_typed = false warn_required_dynamic_aliases = true warn_untyped_fields = true # -- RUFF CONFIG ---------------------------------------------------------------------- [tool.ruff] target-version = "py311" line-length = 100 output-format = "grouped" show-fixes = true show-source = true task-tags = ["TODO", "FIXME", "XXX", "NOTE", "BUG", "HACK", "CHANGE ME"] extend-exclude = [ "*venv*/", "*.bak.*", ] src = ["src", "tests"] unfixable = ["ERA001"] select = [ "A", # flake8-builtins "AIR", # Airflow "ANN", # flake8-annotations "ARG", # flake8-unused-arguments "ASYNC", # flake8-async "B", # flake8-bugbear "BLE", # flake8-blind-except "C4", # flake8-comprehensions "C90", # mccabe # "COM", # flake8-commas # black does that "D", # pydocstyle "DJ", # flake8-django "DTZ", # flake8-datetimez "E", # pycodestyle "EM", # flake8-errmsg "ERA", # flake8-eradicate "EXE", # flake8-executable "F", # pyflakes "FA", # flake8-future-annotations "FBT", # flake8-boolean-trap # "FIX", # flake8-fixme # custom pre-commit hook does with RegEx "FLY", # flynt "G", # flake8-logging-format "I", # isort "ICN", # flake8-import-conventions "INP", # flake8-no-pep420 "INT", # flake8-gettext "ISC", # flake8-implicit-str-concat "N", # pep8-naming "NPY", # NumPy-specific rules "PD", # flake8-vet "PERF", # Perflint "PGH", # pygrep-hooks "PIE", # flake8-pie "PLC", # Pylint - Convention "PLE", # Pylint - Error "PLR", # Pylint - Refactor "PLW", # Pylint - Warning "PT", # flake8-pytest-style "PTH", # flake8-use-pathlib "PYI", # flake8-pyi "Q", # flake8-quotes "RET", # flake8-return "RUF", # Ruff-specific rules "RSE", # flake8-raise "S", # flake8-bandit "SLF", # flake8-self "SLOT", # flake8-slots "SIM", # flake8-simplify # "T10", # flake8-debugger # pre-commit hook does that "T20", # flake8-print "TCH", # flake8-type-checking # "TD", # flake8-todo "TID", # flake8-tidy-imports "TRY", # tryceratops "UP", # pyupgrade "W", # pycodestyle "YTT", # flake8-2020 ] ignore = [ # deactivate because unwanted "ANN101", # type self "ANN102", # type cls "E501", # line length "PT011", # Use match for specific exceptions in pytest.raises ] [tool.ruff.per-file-ignores] "**/tests/**" = [ "ARG", # unused arguments "PLR0913", # Too many arguments to function call "PLR2004", # Magic value comparison "S101", # assert used "SLF001", # Private member accessed ] "**/tests/**/*_test.py" = [ "FBT001", # Boolean positional arg in function definition ] "__init__.py" = [ "D104", # Missing docstring in public package "PLC0414", # useless-import-alias ] "**/testing/examples/**" = [ "ERA001", # commented out code ] "docs/source/conf.py" = [ "INP001", # implicit namespace ] "__version__.py" = ["ALL"] [tool.ruff.flake8-annotations] suppress-dummy-args = true [tool.ruff.flake8-builtins] builtins-ignorelist = [ "id", ] [tool.ruff.flake8-import-conventions.extend-aliases] "typing" = "t" [tool.ruff.flake8-pytest-style] fixture-parentheses = false mark-parentheses = false [tool.ruff.flake8-type-checking] runtime-evaluated-base-classes = [ "pydantic.BaseModel", ] [tool.ruff.isort] combine-as-imports = true required-imports = [ "from __future__ import annotations", ] [tool.ruff.mccabe] max-complexity = 20 [tool.ruff.pep8-naming] classmethod-decorators = [ "pydantic.field_validator", ] staticmethod-decorators = [] [tool.ruff.pycodestyle] ignore-overlong-task-comments = true max-doc-length = 100 [tool.ruff.pydocstyle] convention = "pep257" ignore-decorators = [ "typing.overload", ] property-decorators = [] [tool.ruff.pylint] max-args = 6 # -- PYTEST CONFIG -------------------------------------------------------------------- [tool.pytest.ini_options] addopts = "-ra --showlocals" # -- COVERAGE CONFIG ------------------------------------------------------------------ [tool.coverage] [tool.coverage.run] plugins = ["coverage_conditional_plugin"] branch = true parallel = true context = "static-context" omit = [ "tests/*", ] [tool.coverage.paths] tox_combine = [ "src/rstcheck_core", "*/.tox/*/lib/python*/site-packages/rstcheck_core", "*/.tox/pypy*/site-packages/rstcheck_core", "*/.tox\\*\\Lib\\site-packages\\rstcheck_core", ] local_combine = [ "src/rstcheck_core", "*/.venv/lib/python*/site-packages/rstcheck_core", "*/.venv\\*\\Lib\\site-packages\\rstcheck_core", "*/src/rstcheck_core", "*\\src\\rstcheck_core", ] [tool.coverage.report] show_missing = true exclude_lines = [ "# pragma: no cover", "if __name__ == ['\"]__main__['\"]:", "def __str__", "def __repr__", "if self.debug:", "if settings.DEBUG", "if 0:", "if False:", "if TYPE_CHECKING:", "if MYPY:", ] [tool.coverage.html] show_contexts = true [tool.coverage.coverage_conditional_plugin.rules] # use with: # pragma: py-gte-310 = "sys_version_info >= (3, 10)"