# Codecov Configuration
# https://docs.codecov.com/docs/codecov-yaml

codecov:
  require_ci_to_pass: true
  notify:
    wait_for_ci: true

coverage:
  precision: 2
  round: down
  range: "60...100"
  
  status:
    project:
      default:
        target: auto
        threshold: 5%
        if_ci_failed: error
        # Only count backend and frontend for overall coverage
        flags:
          - backend
          - frontend
    patch:
      default:
        target: auto
        threshold: 5%

# Define coverage flags for different parts of the project
flags:
  backend:
    paths:
      - portal/backend/app/
    carryforward: true
    
  frontend:
    paths:
      - portal/frontend/src/
    carryforward: true
    
  python:
    paths:
      - data-importer/scripts/
    carryforward: true
    # Python data-importer is auxiliary, don't count towards main coverage
    after_n_builds: 1

# Ignore certain files from coverage
ignore:
  - "**/tests/**"
  - "**/test_*.py"
  - "**/*.spec.ts"
  - "**/*Test.php"
  - "**/vendor/**"
  - "**/node_modules/**"
  - "**/database/migrations/**"
  - "**/database/seeders/**"
  - "**/config/**"

# Comment configuration for PRs
comment:
  layout: "reach,diff,flags,files"
  behavior: default
  require_changes: true
  require_base: false
  require_head: true

# GitHub Checks
github_checks:
  annotations: true
