[build-system]
requires = [
  "setuptools >= 80.10.2",
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
version = {attr = "cfnlint.version.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}
dependencies = { file = ["requirements/base.txt"] }
optional-dependencies.graph = { file = ["requirements/optional-graph.txt"] }
optional-dependencies.junit = { file = ["requirements/optional-junit.txt"] }
optional-dependencies.sarif = { file = ["requirements/optional-sarif.txt"] }
optional-dependencies.full = { file = ["requirements/optional-graph.txt","requirements/optional-junit.txt","requirements/optional-sarif.txt"] }

[project]
name = "cfn-lint"
description = "Checks CloudFormation templates for practices and behaviour that could potentially be improved"
requires-python = ">=3.10,<3.15"
license = "MIT-0"
keywords = ["aws", "cloudformation", "lint"]
authors = [
  {email = "kddejong@amazon.com"},
  {name = "Kevin DeJong"},
]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Natural Language :: English",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
]
dynamic = ["version", "readme", "dependencies", "optional-dependencies"]

[project.scripts]
cfn-lint = "cfnlint.runner:main"

[tool.setuptools.package-data]
cfnlint = ["data/**/*.json"]

[project.urls]
Homepage = "https://github.com/aws-cloudformation/cfn-lint"
Documentation = "https://github.com/aws-cloudformation/cfn-lint"
Issues = "https://github.com/aws-cloudformation/cfn-lint/issues"
Changelog = "https://github.com/aws-cloudformation/cfn-lint/blob/main/CHANGELOG.md"
Source = "https://github.com/aws-cloudformation/cfn-lint"

[tool.isort]
profile = "black"

[tool.bandit]
skips = ["B101", "B303", "B310", "B110", "B112", "B324", "B404", "B603", "B607"]
exclude_dirs = ["tests", "scripts"]

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
lint.select = ["E", "F"]
lint.ignore = []
line-length = 88

# Allow autofix for all enabled rules (when `--fix`) is provided.
lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
lint.unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".git-rewrite",
    ".hg",
    ".mypy_cache",
    ".nox",
    ".pants.d",
    ".pytype",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    "__pypackages__",
    "_build",
    "buck-out",
    "build",
    "dist",
    "node_modules",
    "venv",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.format]
quote-style = "double"

[tool.pytest.ini_options]
addopts = [
  "-m not data"
]
markers = [
  "data: marks tests as slow (deselect with '-m \"not data\"')",
]
testpaths = [
    "test",
]

[tool.coverage.run]
branch = true
source = [
  "src/cfnlint"
]

[tool.coverage.report]
skip_empty = true
skip_covered = true
show_missing = true
sort = "Cover"
exclude_lines = [
  "pragma: no cover",
  "if TYPE_CHECKING:"
]

[tool.tox]
env_list = ["py310", "py311", "py312", "py313", "py314", "style"]

[tool.tox.env_run_base]
skip_install = true
commands = [
  ["pip", "install", "-e", ".[full]"],
  ["pip", "install", "-r", "requirements/dev.txt"],
  ["coverage", "run", "-m", "pytest", {replace = "posargs", default = ["test"], extend = true}],
  ["coverage", "xml"],
]
set_env = { LANG = "en_US.UTF-8", AWS_DEFAULT_REGION = "us-east-1" }

[tool.tox.env.style]
skip_install = true
commands = [
  ["pip", "install", "pre-commit"],
  ["pre-commit", "run", "--all-files"],
]

[tool.tox.gh.python]
"3.10" = ["py310"]
"3.11" = ["py311"]
"3.12" = ["py312"]
"3.13" = ["py313", "style"]
"3.14" = ["py314"]

[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
files = [
  "src/cfnlint/**/*.py"
]
exclude = [
  "src/cfnlint/data/"
]

# Per-module options:
[[tool.mypy.overrides]]
module = "networkx.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pydot.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pygraphviz.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "importlib_resources.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "samtranslator.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "sarif_om.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "jschema_to_python.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "junit_xml.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "jsonpatch.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "urllib2.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "json.*"
ignore_missing_imports = true
