[tool.ruff]
line-length = 88
target-version = "py310"

[tool.ruff.per-file-target-version]
"test_typealias_py312.py" = "py312"

[tool.ruff.lint]
select = [
    "ASYNC",  # flake8-async
    "B",      # flake8-bugbear
    "C4",     # flake8-comprehensions
    "COM",    # flake8-commas
    "DJ",     # flake8-django
    "E",      # pycodestyle
    "F",      # Pyflakes
    "FBT",    # flake8-boolean-trap
    "FLY",    # flynt
    "G",      # flake8-logging-format
    "INT",    # flake8-gettext
    "ISC",    # flake8-implicit-str-concat
    "NPY",    # NumPy-specific rules
    "PD",     # pandas-vet
    "PIE",    # flake8-pie
    "PLE",    # Pylint errors
    "PT",     # flake8-pytest-style
    "RET504", # flake8-return
    "RSE",    # flake8-raise
    "SIM",    # flake8-simplify
    "T10",    # flake8-debugger
    "TID",    # flake8-tidy-imports
    "UP",     # pyupgrade
    "W",      # pycodestyle
    "YTT",    # flake8-2020
    "RUF",    # Ruff-specific rules
]
ignore = [
  "B008",
  "B018",
  "C408",
  "C420",
  "COM812",
  "DJ007",
  "DJ008",
  # "line too long". ruff uses tool.ruff.line-length both for this rule, and for `ruff format`.
  # We want ruff format to match black's 88 line length, so we set tool.ruff.line-length = 88. But
  # this is a formatter suggestion, not a rule, so we also disable the E501 lint.
  "E501",
  "E721",
  "E731",
  "E741",
  "FBT001",
  "FBT003",
  "FBT001",
  "PD011",
  "PIE790",  # See https://github.com/astral-sh/ruff/issues/10538
  "PT001",
    "PT003",
    "PT006",
    "PT007",
    "PT009",
    "PT011",
    "PT012",
    "PT013",
    "PT015",
    "PT017",
    "PT019",
    "PT023",
    "PT027",
    "PT031",
    "RUF001",  # don't break our tests by rewriting confusables
    "RUF005",
    "RUF017",
    "RUF028",  # we use fmt: off for black as well as ruff, with differing semantics
    "SIM102",
    "SIM105",
    "SIM108",
    "SIM114",
    "SIM300",
    "SIM905",
    "UP031",
    "UP037",
]

[tool.ruff.lint.per-file-ignores]
"hypothesis-python/src/hypothesis/core.py" = ["B030", "B904"]
"hypothesis-python/src/hypothesis/internal/compat.py" = ["F401"]
"hypothesis-python/tests/nocover/test_imports.py" = ["F403", "F405"]
"hypothesis-python/tests/numpy/test_randomness.py" = ["NPY002"]
"hypothesis-python/src/hypothesis/internal/conjecture/*" = ["B023"]
"hypothesis-python/tests/conjecture/test_data_tree.py" = ["B023"]

[tool.mypy]
python_version = "3.14"
platform = "linux"

allow_redefinition = true
disallow_untyped_decorators = true
disallow_incomplete_defs = true
no_implicit_optional = true
no_implicit_reexport = true

follow_imports = "silent"
ignore_missing_imports = true

strict_equality = true
warn_no_return = true
warn_unused_ignores = true
warn_unused_configs = true
warn_redundant_casts = true

disable_error_code = "annotation-unchecked"

# pytest 9 added support for [tool.pytest], which we should move to when pytest 9
# is the oldest one we support.
[tool.pytest.ini_options]
# -rfEX :: Print a summary of failures, errors, and xpasses (xfails that pass).
addopts = "-rfEX --strict-markers --tb=native -p pytester -p no:legacypath --runpytest=subprocess --durations=20 --durations-min=1.0"
xfail_strict = true
filterwarnings = [
    "error",
    # https://github.com/pandas-dev/pandas/issues/41199
    "default:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning",
    "default:distutils Version classes are deprecated\\. Use packaging\\.version instead:DeprecationWarning",
    # https://github.com/pandas-dev/pandas/issues/32056 (?)
    "default:numpy\\.ufunc size changed, may indicate binary incompatibility\\. Expected 216 from C header, got 232 from PyObject:RuntimeWarning",
    # https://github.com/pandas-dev/pandas/issues/34848
    "default:`np\\.bool` is a deprecated alias for the builtin `bool`:DeprecationWarning",
    "default:`np\\.complex` is a deprecated alias for the builtin `complex`:DeprecationWarning",
    "default:`np\\.object` is a deprecated alias for the builtin `object`:DeprecationWarning",
    # pytest-cov can't see into subprocesses; we'll see <100% covered if this is an issue
    "ignore:Module hypothesis.* was previously imported, but not measured",
    "ignore:CrosshairPrimitiveProvider.realize does not have the for_failure parameter",
]
