[build-system]
requires = ["setuptools", "wheel", "setuptools-rust"]
build-backend = "setuptools.build_meta"

[project]
name = "vcsgraph"
description = "Graph algorithms for version control systems"
readme = "README.md"
requires-python = ">=3.10"
license-files = ["COPYING.txt"]
dynamic = ["version"]

[project.optional-dependencies]
dev = [
    "mypy==2.1.0",
    "ruff==0.15.18"
]

[tool.setuptools]
packages = ["vcsgraph"]

[[tool.setuptools-rust.ext-modules]]
target = "vcsgraph._graph_rs"
path = "crates/graph-py/Cargo.toml"
binding = "PyO3"

[tool.setuptools.dynamic]
version = {attr = "vcsgraph.__version__"}

[tool.mypy]
ignore_missing_imports = true

[tool.ruff]
extend-exclude = ["lib", "bin"]

[tool.ruff.lint]
select = [
    "ANN",  # annotations
    "D",  # pydocstyle
    "E",  # pycodestyle
    "F",  # pyflakes
    "N",  # naming
    "B",  # bugbear
    "I",  # isort
    "S",  # bandit
    "TCH", # typecheck
    "INT", # gettext
   "SIM", # simplify
    "C4",  # comprehensions
    "UP",  # pyupgrade
    "RUF", # ruf-specific
]
ignore = [
    "ANN001",
    "ANN002",
    "ANN003",  # missing-type-arg
    "ANN201",
    "ANN202",
    "ANN204",
    "ANN205",
    "ANN206",
    "D205",  # 1 blank line required between summary line and description
    "D417",  # Missing argument descriptions in the docstring
    "F821",  # undefined-name
    "E501",  # line too long
    "D402",  # Missing blank line after last section
    "E402",  # module level import not at top of file
    "E741",  # ambiguous variable name
    "F405",  # name may be undefined, or defined from star imports
    "N801",  # Naming convention violation: invalid constant name
    "N802",  # Naming convention violation: invalid variable name
    "N804",  # Naming convention violation: invalid lowercase variable name
    "N806",  # Naming convention violation: invalid lowercase function name
    "N818",  # Naming convention violation: invalid argument name
    "N999",  # Naming convention violation: invalid module name

    "S602",  # subprocess with shell=True
    "S603",  # check for execution of untrusted input
    "S105",  # "hardcoded password"; false positives on "pwd"
    "S106",  # "hardcoded password"; false positives on "pwd"
    "S110",  # "consider logging exception"

    "S317",  # use defusedxml

    # This triggers for docstrings that uses __doc__
    "D104", # Missing docstring in public package

    "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
    "RUF005", # Consider iterable concatenation instead of list concatenation
    "RUF015", # Prefer next() of single slice access

    "SIM102", # Use a single `if` statement instead of nested `if` statements
    "SIM105", # Use `contextlib.suppress
    "SIM108", # Use ternary operator
    "SIM114", # Combine `if` branches using logical `or` operator
    "SIM115", # Use context handler for opening files
]

[tool.ruff.lint.extend-per-file-ignores]
# Ignore docstring requirements for test files
"vcsgraph/tests/*.py" = ["D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107"]

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

[tool.cibuildwheel.linux]
skip = "*-musllinux_*"
archs = ["auto", "aarch64"]
