[tool.bumpversion]
current_version = "0.19.1"
commit = true
tag = true
tag_name = "{new_version}"

[[tool.bumpversion.files]]
filename = 'CHANGELOG.rst'
search = "\\(unreleased\\)$"
replace = "({now:%Y-%m-%d})"
regex = true

[[tool.bumpversion.files]]
filename = "docs/conf.py"

[[tool.bumpversion.files]]
filename = "setup.py"
parse = "version\\s*=\\s*['\"](?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"

[tool.coverage.report]
exclude_also = [
    "if TYPE_CHECKING:",
]

[tool.mypy]
ignore_missing_imports = false
implicit_reexport = true

[[tool.mypy.overrides]]
module = "tests.*"
allow_untyped_defs = true
allow_incomplete_defs = true

[[tool.mypy.overrides]]
module = "web_poet.example"
ignore_errors = true

[[tool.mypy.overrides]]
module = "tests.po_lib_to_return.*"
# Ignore mypy errors since the Page Objects contain arbitrary reference values
# used for assertions which have varying types. This upsets mypy.
ignore_errors = true

[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"

[tool.ruff.lint]
extend-select = [
    # flake8-bugbear
    "B",
    # flake8-comprehensions
    "C4",
    # pydocstyle
    "D",
    # flake8-future-annotations
    "FA",
    # flynt
    "FLY",
    # refurb
    "FURB",
    # isort
    "I",
    # flake8-implicit-str-concat
    "ISC",
    # flake8-logging
    "LOG",
    # Perflint
    "PERF",
    # pygrep-hooks
    "PGH",
    # flake8-pie
    "PIE",
    # pylint
    "PL",
    # flake8-pytest-style
    "PT",
    # flake8-use-pathlib
    "PTH",
    # flake8-pyi
    "PYI",
    # flake8-quotes
    "Q",
    # flake8-return
    "RET",
    # flake8-raise
    "RSE",
    # Ruff-specific rules
    "RUF",
    # flake8-bandit
    "S",
    # flake8-simplify
    "SIM",
    # flake8-slots
    "SLOT",
    # flake8-debugger
    "T10",
    # flake8-type-checking
    "TC",
    # pyupgrade
    "UP",
    # pycodestyle warnings
    "W",
    # flake8-2020
    "YTT",
]
ignore = [
    # Missing docstring in public module
    "D100",
    # Missing docstring in public class
    "D101",
    # Missing docstring in public function
    "D103",
    # Missing docstring in public package
    "D104",
    # Missing docstring in magic method
    "D105",
    # Missing docstring in __init__
    "D107",
    # One-line docstring should fit on one line with quotes
    "D200",
    # No blank lines allowed after function docstring
    "D202",
    # 1 blank line required between summary line and description
    "D205",
    # Multi-line docstring closing quotes should be on a separate line
    "D209",
    # First line should end with a period
    "D400",
    # First line should be in imperative mood; try rephrasing
    "D401",
    # First line should not be the function's "signature"
    "D402",
    # Too many return statements
    "PLR0911",
    # Too many branches
    "PLR0912",
    # Too many arguments in function definition
    "PLR0913",
    # Too many statements
    "PLR0915",
    # Magic value used in comparison
    "PLR2004",
    # Mutable class attributes should be annotated with `typing.ClassVar`
    "RUF012",
    # Use of `assert` detected
    "S101",
    # Move application import {} into a type-checking block
    # (The fix can break singledispatch() and/or andi.)
    "TC001",
    # Add `from __future__ import annotations` to simplify
    # (The fix can break singledispatch() and/or andi.)
    "FA100",
]

[tool.ruff.lint.per-file-ignores]
# F401: Ignore "imported but unused" errors in __init__ files, as those
# imports are there to expose submodule functions so they can be imported
# directly from that module
# F403: Ignore * imports in these files
# D102: Missing docstring in public method
# S: flake8-bandit
# B018: Found useless expression.
"web_poet/__init__.py" = ["F401", "F403"]
"web_poet/exceptions/__init__.py" = ["F401", "F403"]
"web_poet/page_inputs/__init__.py" = ["F401", "F403"]
"web_poet/serialization/__init__.py" = ["F401", "F403"]
"web_poet/testing/__init__.py" = ["F401", "F403"]
"web_poet/testing/pytest.py" = ["D102"]
"tests/**" = ["B018", "D102", "S"]
"web_poet/example.py" = ["S"]
# Documentation examples may miss docstrings and include undefined, example
# names.
"docs/**" = ["D102", "F821"]

[tool.ruff.lint.pydocstyle]
convention = "pep257"
