[project]
name = "octopus"
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.11"

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

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

################################################################################
# Lint configuration
################################################################################
[tool.ruff]
extend-exclude = [
    # Pending refactor
    "data/wfi_loader",
    "enrich/activity_tracking_ids",
    "enrich/extract_zip",
    "enrich/fetch_wfi_metadata",
    "enrich/filter_items",
    "integration/studio/document_status_tracking",
    "scheduled_jobs/activity_tracking",
    # Temporary
    "deployment/redis_sentinel",          # Obsolete, will be removed
    "integration/studio/user_roles_repo", # tmp
    "tests",
    # OOTB
    "common",
    "data/exchange_plugin",
    "deployment/ansible/roles/squirro-ansible",
    "deployment/remote_automl_classifier",
    "integration/studio/extauth_saml",
    "integration/studio/pdf_table_extraction",
]
fix = true
line-length = 88
target-version = "py311"

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88

[tool.ruff.lint]
fixable = ["ALL"]
ignore = [
    # Allow blind exceptions
    "BLE001",
    # Conflict with formatter
    "COM812",
    "ISC001",
    # Allow df = ...
    "PD901",
]
preview = true
select = [
    "A",
    "AIR",
    "ANN",
    "ARG",
    "ASYNC",
    "B",
    "BLE",
    "C4",
    "C90",
    "COM",
    "D",
    "DJ",
    "DOC",
    "DTZ",
    "E",
    "EM",
    "ERA",
    "EXE",
    "F",
    "FA",
    "FAST",
    "FBT",
    "FIX",
    "FLY",
    "FURB",
    "G",
    "I",
    "ICN",
    "INP",
    "INT",
    "ISC",
    "LOG",
    "N",
    "NPY",
    "PD",
    "PERF",
    "PGH",
    "PIE",
    "PLC",
    "PLE",
    "PLR",
    "PLW",
    "PT",
    "PTH",
    "PYI",
    "Q",
    "RET",
    "RSE",
    "RUF",
    "S",
    "SIM",
    "SLF",
    "SLOT",
    "T10",
    "T20",
    "TCH",
    "TD",
    "TID",
    "TRY",
    "UP",
    "W",
    "YTT",
]

[tool.ruff.lint.isort]
known-first-party = ["squirro", "squirro_client"]

[tool.ruff.lint.per-file-ignores]
"data/**.py" = [
    # getArguments do not need docstring
    "D102",
    "D104",
    # Data loader are not part of any package
    "INP001",
    # Ignore camelcase
    "N802",
    # Ignore getArguments function
    "PLR6301",
]
"deployment/**.py" = [
    # Deployment scripts are not part of any package
    "INP001",
]
"enrich/**.py" = [
    # Pipelets are not part of any package
    "INP001",
]
"integration/studio/**.py" = [
    # project_id needs to be present in function argument for authenticated acccess
    "ARG001",
    # Studio plugins are not public package
    "D104",
]
"scheduled_jobs/**.py" = [
    # Scheduled jobs are not part of any package
    "INP001",
]
"services/**.py" = [
    # Services are not part of any package
    "INP001",
]
"scripts/**.py" = [
    # Pipelets are not part of any package
    "INP001",
]
"**/*test*.py" = [
    # Typing
    "ANN001",
    "ANN201",
    "ANN202",
    "ARG002",
    # Ignore broad exception
    "B017",
    # Docstring
    "D100",
    "D101",
    "D102",
    "D103",
    # Ignore timezone
    "DTZ005",
    "DTZ011",
    # Line too long not important in test
    "E501",
    # open() is fine
    "FURB101",
    "PTH123",
    # Code inside tests are not part of any package
    "INP001",
    # Allow ignore all
    "PGH004",
    # Private name import
    "PLC2701",
    # Magic values irrelevant
    "PLR2004",
    # Ignore class where self is not used
    "PLR6301",
    # Ignore broad exception
    "PT011",
    # Fixture without value injected
    "PT019",
    # Multiple with
    "SIM117",
    # Private member allowed
    "SLF001",
    # Assert is allowed
    "S101",
    #Ignore hardcoded token
    "S106",
]

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