Skip to content

Latest commit

 

History

History
224 lines (174 loc) · 3.74 KB

File metadata and controls

224 lines (174 loc) · 3.74 KB

AI SLOP Detector Configuration Examples

Example 1: Basic Configuration in pyproject.toml

[tool.slop-detector]
# Ignore patterns
ignore = [
    "tests/**",
    "migrations/**",
    "**/__pycache__/**",
]

# Fail threshold for CI/CD
fail-threshold = 30

# Minimum severity to report
severity = "medium"

# Disabled patterns
disable = [
    "todo_comment",  # Allow TODO comments in this project
    "magic_number",  # Allow magic numbers
]

Example 2: Strict Configuration

[tool.slop-detector]
ignore = ["tests/**"]
fail-threshold = 20
severity = "high"  # Only high and critical

# Enable all patterns
disable = []

# Pattern-specific settings
[tool.slop-detector.patterns]
enable-cross-language = true

Example 3: Lenient Configuration

[tool.slop-detector]
ignore = [
    "tests/**",
    "examples/**",
    "docs/**",
]
fail-threshold = 50
severity = "critical"  # Only critical issues

# Disable placeholder checks (prototype project)
disable = [
    "pass_placeholder",
    "todo_comment",
    "fixme_comment",
    "hack_comment",
]

Example 4: Enterprise Configuration

[tool.slop-detector]
ignore = ["tests/**", "migrations/**"]
fail-threshold = 25
severity = "medium"

# Strict structural checks
disable = []

[tool.slop-detector.thresholds]
# Custom thresholds
ldr = {excellent = 0.90, good = 0.80}
ddc = {excellent = 0.95, good = 0.80}

[tool.slop-detector.weights]
# Custom weights for scoring
ldr = 0.50  # Emphasize logic density
inflation = 0.30
ddc = 0.20

Using with .slopconfig.yaml

You can also use .slopconfig.yaml for more complex configurations:

version: "3.5.0"

thresholds:
  ldr: {excellent: 0.85, good: 0.75}
  ddc: {excellent: 0.90, good: 0.70}
  deficit:
    suspicious: 30
    inflated: 50
    critical: 70

weights:
  ldr: 0.40
  inflation: 0.30
  ddc: 0.30
  purity: 0.10

ignore:
  - "tests/**"
  - "**/__init__.py"

patterns:
  enabled: true
  disabled:
    - "todo_comment"
    - "magic_number"
  severity_threshold: "medium"

Example 5: Domain-Aware Configuration (v3.4.0+)

Generated by slop-detector --init for a scientific/ML project:

version: "3.5.0"

domain: "scientific_ml"

weights:
  ldr: 0.35        # looser — ML files have framework boilerplate
  inflation: 0.15  # looser — domain jargon (fit, predict, loss) is legitimate
  ddc: 0.35
  purity: 0.15

thresholds:
  deficit:
    suspicious: 35   # raised from 30 — more tolerance for ML scaffolding
    inflated: 55
    critical: 75

ignore:
  - "tests/**"
  - "notebooks/**"
  - "**/__init__.py"

patterns:
  disabled:
    - "cross_language"

Generated by slop-detector --init for a web/API project:

version: "3.5.0"

domain: "web_api"

weights:
  ldr: 0.40
  inflation: 0.30
  ddc: 0.30
  purity: 0.10

thresholds:
  deficit:
    suspicious: 30
    inflated: 50
    critical: 70

Pre-commit Hook Configuration

Create .pre-commit-config.yaml:

repos:
  - repo: https://github.com/flamehaven/ai-slop-detector
    rev: v3.5.0
    hooks:
      - id: slop-detector
        args: ['--fail-threshold', '30']
      
      # Or use strict mode
      - id: slop-detector-strict
        args: ['--fail-threshold', '20', '--severity', 'high']

Then install:

pre-commit install

CI/CD Integration Examples

GitHub Actions

- name: Check code quality
  run: |
    pip install ai-slop-detector
    slop-detector --project . --fail-threshold 30

GitLab CI

slop-check:
  script:
    - pip install ai-slop-detector
    - slop-detector --project . --fail-threshold 30
  allow_failure: false

Jenkins

stage('SLOP Check') {
    steps {
        sh 'pip install ai-slop-detector'
        sh 'slop-detector --project . --fail-threshold 30'
    }
}