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

# Coverage targets and thresholds
coverage:
  precision: 2  # 2 decimal places
  round: down
  range: 70..100  # Green at 70%+, red below

  status:
    # Overall project coverage
    project:
      default:
        target: 70%  # Target coverage for the entire project
        threshold: 2%  # Allow 2% drop before failing
        if_ci_failed: error  # Fail if CI failed
        informational: false  # Block PR if coverage drops

    # Patch coverage (new code in PR)
    # Note: Some code in native.rs requires GUI environment and cannot be tested in CI
    patch:
      default:
        target: 70%  # Lowered due to untestable GUI code in native backend
        threshold: 10%  # More lenient for patches with GUI code
        if_ci_failed: error
        informational: true  # Don't block PR for patch coverage

    # Changes coverage (lines changed in PR)
    changes:
      default:
        target: 80%
        threshold: 5%
        if_ci_failed: error
        informational: true  # Don't block PR, just inform

# Comment configuration
comment:
  layout: "header, diff, flags, components, footer"
  behavior: default  # Update existing comment
  require_changes: false  # Always comment
  require_base: false  # Comment even without base
  require_head: true  # Require head commit

# Flag configuration for different test types
flags:
  # Python coverage
  python:
    paths:
      - python/
    carryforward: true  # Carry forward if missing

  # Rust coverage (main crate)
  rust:
    paths:
      - src/
    carryforward: true

  # Rust crates coverage
  rust-core:
    paths:
      - crates/auroraview-core/
    carryforward: true

  rust-pack:
    paths:
      - crates/auroraview-pack/
    carryforward: true

  rust-cli:
    paths:
      - crates/auroraview-cli/
    carryforward: true

  rust-plugins:
    paths:
      - crates/auroraview-plugins/
    carryforward: true

  # Unit tests
  unit:
    carryforward: true

  # Qt tests
  qt:
    carryforward: true

  # Windows-specific
  windows:
    carryforward: true

# Component configuration
component_management:
  individual_components:
    # Python components
    - component_id: python_core
      name: Python Core
      paths:
        - python/auroraview/*.py
      flag_regexes:
        - python

    - component_id: python_qt
      name: Python Qt Integration
      paths:
        - python/auroraview/integration/qt/*.py
      flag_regexes:
        - python
        - qt

    # Rust main crate
    - component_id: rust_main
      name: Rust Main
      paths:
        - src/**/*.rs
      flag_regexes:
        - rust

    # Rust crates
    - component_id: rust_core
      name: AuroraView Core
      paths:
        - crates/auroraview-core/**/*.rs
      flag_regexes:
        - rust-core

    - component_id: rust_pack
      name: AuroraView Pack
      paths:
        - crates/auroraview-pack/**/*.rs
      flag_regexes:
        - rust-pack

    - component_id: rust_cli
      name: AuroraView CLI
      paths:
        - crates/auroraview-cli/**/*.rs
      flag_regexes:
        - rust-cli

    - component_id: rust_plugins
      name: AuroraView Plugins
      paths:
        - crates/auroraview-plugins/**/*.rs
      flag_regexes:
        - rust-plugins

# Ignore paths (for project coverage calculation only, not patch coverage)
ignore:
  # Test directories (all levels)
  - "tests/"
  - "crates/*/tests/"
  # Non-code files
  - "examples/"
  - "docs/"
  - "*.md"
  - "*.toml"
  - "*.yml"
  - "*.yaml"
  - ".github/"
  - "scripts/"
  - "gallery/"
  # Auto-generated files
  - "python/auroraview/_version.py"
  # Rust module definition files (no logic to test)
  - "**/mod.rs"
  # Template files
  - "**/templates/"
  # Build artifacts
  - "target/"
  - "pack-output/"

# GitHub checks
github_checks:
  annotations: true  # Add annotations to PR

# Codecov AI (if enabled)
codecov_ai:
  enabled: true

