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

[project]
name = "edwh-files-plugin"
dynamic = ["version"]
description = '`edwh` plugin for files.edwh.nl'
readme = "README.md"
requires-python = ">=3.10"
license-expression = "MIT"
keywords = []
authors = [
    { name = "Remco Boerma", email = "remco.b@educationwarehouse.nl" },
    { name = "Robin van der Noord", email = "robin.vdn@educationwarehouse.nl" },
]
classifiers = [
    "Development Status :: 4 - Beta",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
    'requests',
    'requests_toolbelt',
    'rich',
    'progress',
    'threadful',
]

[project.optional-dependencies]
dev = [
    "edwh",
    "hatch",
    # "python-semantic-release",
    "black",
    "pytest",
    "pytest-coverage",
]

[project.urls]
Documentation = "https://github.com/educationwarehouse/edwh-files-plugin#readme"
Issues = "https://github.com/educationwarehouse/edwh-files-plugin/issues"
Source = "https://github.com/educationwarehouse/edwh-files-plugin"

# https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata
[project.entry-points."edwh.tasks"]
file = "edwh_files_plugin.files_plugin"

[tool.hatch.version]
path = "src/edwh_files_plugin/__about__.py"

[tool.semantic_release]
branch = "master"
version_variable = "src/edwh_files_plugin/__about__.py:__version__"
change_log = "CHANGELOG.md"
upload_to_repository = false
upload_to_release = false
build_command = "hatch build"

parser_angular_minor_types = "feat,minor"
parser_angular_patch_types = "fix,perf,refactor,build,chore,patch"


[tool.hatch.envs.default]
dependencies = [
    "coverage[toml]>=6.5",
    "pytest",
]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = [
    "- coverage combine",
    "coverage report",
]
cov = [
    "test-cov",
    "cov-report",
]

[[tool.hatch.envs.all.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.hatch.envs.lint]
detached = true
dependencies = [
    "black>=23.1.0",
    "mypy>=1.0.0",
    "ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/edwh_files_plugin tests}"
style = [
    "ruff {args:.}",
    "black --check --diff {args:.}",
]
fmt = [
    "black {args:.}",
    "ruff --fix {args:.}",
    "style",
]
all = [
    "style",
    "typing",
]

[tool.black]
target-version = ["py310"]
line-length = 120

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

[tool.ruff.lint]
select = [
    "F", # pyflake error
    "E", # pycodestyle error
    "W", # pycodestyle warning
    "Q", # quotes
    "A", # builtins
    # "C4", # comprehensions
    # "RET", # return
    "SIM", # simplify
    "ARG", # unused arguments
    # "COM", # comma's
    "PTH", # use pathlib
    "RUF", # ruff rules
    "C90", # mccabe (complexity)
    #    "I", # isort
    "N", # pep-8 naming
    # "D", # pydocstyle
    # "UP", # pyupgrade
    "YTT", # flake8-2020 (version hardcoding)
    # "ANN", # annotations - werkt niet goed samen met invoke
    # "ASYNC", # async - gebruiken we hier niet
    # "S", # bandit (security)
    # "BLE", # blind except
    # "FBT", # boolean trap
    # "B", # bugbear
    # "DTZ", # datetimes
    # "T10", # debugger
    # "DJ", # django
    # "ISC", # implicit string concat (handig voor als je een , mist in een lijst bijv.)
    "SIM", # simplify
]

ignore = [
    # Allow non-abstract empty methods in abstract base classes
    "B027",
    # Allow boolean positional values in function calls, like `dict.get(... True)`
    "FBT003",
    # Ignore checks for possible passwords
    "S105", "S106", "S107",
    # Ignore complexity
    "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PLR2004",
    # Optional[]
    "UP007",
    # ClassVar:
    "RUF012"
]
unfixable = [
    # Don't touch unused imports
    "F401",
]

[tool.ruff.lint.isort]
known-first-party = ["edwh_files_plugin"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]

[tool.coverage.run]
source_pkgs = ["edwh_files_plugin", "tests"]
branch = true
parallel = true
omit = [
    "src/edwh_files_plugin/__about__.py",
]

[tool.coverage.paths]
edwh_files_plugin = ["src/edwh_files_plugin", "*/edwh-files-plugin/src/edwh_files_plugin"]
tests = ["tests", "*/edwh-files-plugin/tests"]

[tool.coverage.report]
exclude_lines = [
    "no cov",
    "if __name__ == .__main__.:",
    "if TYPE_CHECKING:",
]
