[build-system]
requires = ["hatchling>=1.27"]
build-backend = "hatchling.build"

[project]
name = "dry-lint"
version = "1.5.0"
description = "Find code that re-implements what your codebase already does, judge it, and say so on the pull request"
readme = "README.md"
requires-python = ">=3.11"
license = "Apache-2.0"
license-files = ["LICENSE"]
authors = [{name = "Gigaverse"}]
dependencies = ["httpx>=0.28,<1", "pydantic>=2.11,<3", "tree-sitter>=0.25,<0.26", "tree-sitter-typescript>=0.23,<0.24"]
keywords = ["dry", "duplication", "code-duplication", "linter", "code-review", "pre-commit", "github-actions", "llm"]
classifiers = ["Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Topic :: Software Development :: Quality Assurance", "Programming Language :: Python :: 3", "Typing :: Typed"]

[project.scripts]
dry-lint = "dry_lint.cli:main"

[project.urls]
Homepage = "https://github.com/gigaverse-app/dry-lint"
Documentation = "https://github.com/gigaverse-app/dry-lint/tree/main/docs"
Repository = "https://github.com/gigaverse-app/dry-lint"
Issues = "https://github.com/gigaverse-app/dry-lint/issues"

[project.optional-dependencies]
cpu-embedding = ["numpy>=2.2,<3", "onnxruntime>=1.31.1,<1.32", "tokenizers>=0.23.3,<0.24"]
s3 = ["boto3>=1.35"]
anthropic = ["anthropic>=1.0"]
hooks = ["anthropic>=1.0", "python-dotenv>=1,<2"]
dryer = ["dryer @ git+https://github.com/unclebob/dryer.git@66ff6d21a42c04afcad89c78a80066176d1294b0"]

[tool.hatch.metadata]
allow-direct-references = true

[dependency-groups]
dev = ["pytest>=8", "pytest-cov>=6", "ruff>=0.14", "build>=1.2", "boto3>=1.35", "anthropic>=1.0", "numpy>=2.2", "python-dotenv>=1,<2"]

[tool.hatch.build.targets.wheel]
packages = ["src/dry_lint"]

[tool.hatch.build.targets.sdist]
include = ["src", "tests", "scripts", "docs", "examples", "README.md", "CONTRIBUTING.md", "AGENTS.md", "LICENSE", "pyproject.toml", "uv.lock", "action.yml", ".pre-commit-hooks.yaml"]

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.coverage.run]
source = ["dry_lint"]
omit = ["*/__main__.py"]

[tool.ruff]
line-length = 120
target-version = "py311"

[tool.ruff.lint]
# The same rule sets as gigaverse-app/due: pycodestyle, Pyflakes, isort, pyupgrade and bugbear.
# `ruff format` owns line length; E501 would only flag the long strings and comments it leaves whole.
select = ["E", "F", "I", "UP", "B"]
ignore = ["E501"]

[tool.ruff.lint.isort]
known-local-folder = ["conftest"]

[tool.dry-lint]
# dry-lint checks its own tests too: duplicated fixtures and helpers are the drift it exists to catch.
exclude = ["examples/*", "scripts/*"]

[[tool.dry-lint.patterns]]
members = "tests/*::test_*"
reason = "one test per behaviour: tests repeat the arrange-act-assert shape on purpose"
