# sloc-guard Configuration Example
# Full docs: https://github.com/doraemonkeys/sloc-guard
version = "2"

# Optional: inherit from presets or remote configs
# extends = "preset:rust-strict"
# extends = "https://example.com/shared-config.toml"

# =============================================================================
# Scanner: How to discover files
# =============================================================================
[scanner]
gitignore = true # Respect .gitignore (default: true)
# IMPORTANT: Explicit exclude REPLACES the default [".git/**"], it does NOT merge.
# If you override this, include ".git/**" to keep .git directory excluded.
exclude = [".git/**", "vendor/**", "dist/**"]

# =============================================================================
# Content: SLOC (Source Lines of Code) limits
# =============================================================================
[content]
# File types to analyze (major programming languages)
extensions = [
    "rs",
    "go",
    "c",
    "cpp",   # Systems
    "java",
    "kt",
    "scala", # JVM
    "cs",    # .NET
    "js",
    "ts",
    "tsx",
    "jsx",
    "vue",   # Web/Frontend
    "swift",
    "dart",  # Mobile
    "py",
    "rb",
    "php",
    "lua",
    "sh",    # Scripting
]
max_lines = 600 # Default max lines per file
warn_threshold = 0.9 # Warn at 90% of limit (450 lines)
skip_comments = true # Don't count comment lines
skip_blank = true # Don't count blank lines
exclude = [
    "**/*_test.go",
] # Exclude from SLOC check (still visible to structure)

# Content Rules: Override limits for specific paths (last match wins)
[[content.rules]]
pattern = "src/generated/**"
max_lines = 2000
reason = "Auto-generated code"

[[content.rules]]
pattern = "**/migrations/*.sql"
max_lines = 1000
reason = "SQL migrations can be long"

[[content.rules]]
pattern = "**/*_test.rs"
max_lines = 800
reason = "Test files need more space for fixtures"

# Temporary exemption with expiration
[[content.rules]]
pattern = "src/legacy/parser.rs"
max_lines = 1500
reason = "Refactoring in progress - JIRA-1234"
expires = "2025-03-01"

# =============================================================================
# Structure: Directory organization limits
# =============================================================================
[structure]
max_files = 30                       # Max files per directory
max_dirs = 10                        # Max subdirectories per directory
max_depth = 8                        # Max nesting depth
warn_threshold = 0.8                 # Warn at 80% of limits
count_exclude = ["*.md", ".gitkeep"] # Don't count these toward limits

# Global deny lists
deny_extensions = [".exe", ".dll", ".so"]
deny_files = ["*.bak", "*.tmp", ".DS_Store"]

# Structure Rules: Override for specific directories
[[structure.rules]]
scope = "src/components/**"
max_files = 50
allow_extensions = [".tsx", ".ts", ".css"]
file_naming_pattern = "^[A-Z][a-zA-Z0-9]*\\.(tsx|ts|css)$"
reason = "React components: PascalCase naming required"

[[structure.rules]]
scope = "tests/**"
max_files = -1                                # -1 = unlimited
max_depth = 3
reason = "No file limit for test directories"

[[structure.rules]]
scope = "src/features/**"
siblings = [{ match = "*.tsx", require = "{stem}.test.tsx" }]
reason = "Every component must have a test file"

# =============================================================================
# Baseline: Grandfather existing violations
# =============================================================================
[baseline]
ratchet = "warn" # warn|auto|strict - enforce violations can only decrease

# =============================================================================
# Trend: History tracking settings
# =============================================================================
[trend]
max_entries = 100            # Keep last 100 snapshots
max_age_days = 90            # Delete entries older than 90 days
min_interval_secs = 3600     # At most one entry per hour
min_code_delta = 10          # Ignore changes < 10 lines
auto_snapshot_on_check = true # Record snapshot after successful check (CI-friendly)

# =============================================================================
# Stats: Configuration for stats subcommands
# =============================================================================
[stats.report]
exclude = []           # Sections to exclude: "summary", "files", "breakdown", "trend"
top_count = 20         # Number of top files to show
breakdown_by = "lang"  # Grouping mode: "lang" or "dir"
trend_since = "7d"     # Trend comparison period (e.g., "7d", "1w", "30d")

# =============================================================================
# Custom Languages: Define comment syntax for unsupported languages
# =============================================================================
[languages.hcl]
extensions = ["tf", "hcl"]
single_line_comments = ["#", "//"]
multi_line_comments = [["/*", "*/"]]
