[project]
name = "project"
version = "0.1.0"
authors = ["Your Name <your.email@test.com>"]


# TESTING
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --force-sugar --no-migrations --reuse-db --log-cli-level=INFO"
testpaths = [
    "tests",
]
pythonpath = [".", "src"]
python_files = "tests.py test_*.py *_tests.py"
DJANGO_SETTINGS_MODULE = "agenda_culturel.settings.test"
filterwarnings = [
    'ignore::DeprecationWarning:kombu.*:',
    'ignore::DeprecationWarning:celery.*:',
]

[tool.coverage.report]
fail_under = 85
show_missing = "true"
exclude_lines = [
    "pragma: no cover",
    "raise NotImplementedError",
    "if TYPE_CHECKING:",
    "if __name__ == .__main__.:",
    "import*",
    "def __str__",
    "def on_success",
    "def clean",
    "if missing",
    "if relations.exists()",
    "(FileDoesNotExistException, FileNotSupportedException)",
]


[tool.coverage.run]
omit = [
    "*/tests/*",
    "*/migrations/*",
    "*/urls.py",
    "*/settings/*",
    "*/wsgi.py",
    "manage.py",
    "*__init__.py",
]
source = ["src"]


# LINTING
[tool.black]
line-length = 88
target-version = ['py311']
include = '\.pyi?$'
# 'extend-exclude' excludes files or directories in addition to the defaults
extend-exclude = '''
^(.*/)?migrations/.*$
'''


[tool.ruff]
output-format = "grouped"
line-length = 88 # black default
extend-exclude = [
    "src/migrations/*",
    "src/media/*",
    "src/static/*",
    "src/manage.py",
    "*/test_data/*",
    "*__init__.py",
]

[tool.ruff.lint]
select = ["E", "F"]
ignore = [
    "E501",  # line too long, handled by black
    "B008",  # do not perform function calls in argument defaults
    "C901",  # too complex
    "F405", # name may be undefined, or defined from star imports
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"


[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.ruff.lint.per-file-ignores]
"experimentations/*.py" = ["E402"]

[tool.ruff.lint.isort]
force-to-top = ["src"]
known-first-party = ["src"]

[tool.djlint]
profile = "django"
ignore = "H031,T003,H006"
extension = "html"
files = ["src/agenda_culturel/templates/agenda_culturel/*.html"]
indent = 2
