Guide for contributing to AI-SLOP Detector.
# Clone repository
git clone https://github.com/flamehaven01/AI-SLOP-Detector.git
cd AI-SLOP-Detector
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Verify installation
slop-detector --helpgit checkout -b feature/amazing-featureEdit code in src/slop_detector/
# All tests
pytest tests/ -v
# With coverage
pytest tests/ --cov=src/slop_detector --cov-report=html
# Specific test file
pytest tests/test_core.py -v
# Watch mode (requires pytest-watch)
ptw tests/ -- -v# Linting
ruff check src/ tests/
# Formatting
black src/ tests/
# Type checking (if using mypy)
mypy src/slop_detectorgit add .
git commit -m "feat: Add amazing feature"Commit Convention:
feat:New featurefix:Bug fixdocs:Documentationtest:Testschore:Maintenance
git push origin feature/amazing-feature
# Open PR on GitHubAI-SLOP-Detector/
├── src/slop_detector/
│ ├── __init__.py
│ ├── core.py # Main detector logic + math.isfinite() inflation filter
│ ├── models.py # Data models
│ ├── config.py # Configuration + domain profile loading
│ ├── cli.py # CLI interface (allow_nan=False, tuple sanitizer)
│ ├── cli_commands.py # Command handlers: --init, --self-calibrate,
│ │ # _compute_project_id(), _check_calibration_hint()
│ ├── question_generator.py # Review questions
│ ├── ci_gate.py # CI/CD enforcement
│ ├── history.py # SQLite history tracker (Schema v5, project_id)
│ ├── metrics/ # Analysis metrics
│ │ ├── ldr.py # Logic Density Ratio
│ │ ├── inflation.py # Jargon detection (max cap 10.0, no float inf)
│ │ ├── ddc.py # Dependency check
│ │ ├── context_jargon.py # Evidence validation
│ │ ├── docstring_inflation.py
│ │ └── hallucination_deps.py
│ ├── patterns/ # Pattern detection (27+ patterns)
│ │ ├── base.py
│ │ ├── placeholder.py
│ │ ├── structural.py # god_function, nested_complexity
│ │ ├── cross_language.py
│ │ └── clone_detector.py # function_clone_cluster (v3.1.0)
│ ├── languages/ # Language-specific analyzers (v3.4.0+)
│ │ ├── __init__.py
│ │ ├── python_analyzer.py
│ │ ├── js_analyzer.py # JS/TS patterns (v3.4.0)
│ │ └── go_analyzer.py # Go patterns (v3.5.0)
│ ├── ml/ # Self-calibration engine (v3.2.0+)
│ │ ├── __init__.py
│ │ └── self_calibrator.py # SelfCalibrator, CalibrationResult
│ └── auth/ # Enterprise features
├── tests/ # Test suite (308 tests)
│ ├── test_core.py
│ ├── test_metrics.py
│ ├── test_patterns.py
│ ├── test_ci_gate.py
│ ├── test_calibration_patches.py # 16 P1–P4 unit tests (v3.5.0)
│ └── e2e_v321/ # End-to-end tests
│ └── test_e2e_v321.py
├── docs/ # Documentation
├── vscode-extension/ # VS Code extension (v3.5.0)
├── pyproject.toml # Project metadata
├── .slopconfig.example.yaml # Config template
└── README.md
# All tests with coverage
pytest tests/ -v --cov=src/slop_detector --cov-report=html
# Open coverage report
open htmlcov/index.html # On macOS
# Or: start htmlcov/index.html # On Windows# tests/test_my_feature.py
import pytest
from slop_detector.core import SlopDetector
def test_my_feature():
"""Test my amazing feature."""
detector = SlopDetector()
result = detector.analyze_file("test_file.py")
assert result.deficit_score < 30- Minimum: 80% overall coverage
- Target: 85%+ overall coverage
- New code: 90%+ coverage
# Format code
black src/ tests/
# Check formatting
black --check src/ tests/# Lint code
ruff check src/ tests/
# Fix auto-fixable issues
ruff check --fix src/ tests/- Follow PEP 8
- Use type hints
- Write docstrings for public APIs
- Keep functions focused (single responsibility)
- Prefer explicit over implicit
To add a new evidence type (e.g., "caching"):
-
Update
src/slop_detector/metrics/context_jargon.py:def _has_caching(self, content: str) -> bool: return any(keyword in content for keyword in ["@cache", "redis", "memcache"])
-
Add to
EVIDENCE_REQUIREMENTS:EVIDENCE_REQUIREMENTS = { "performance": ["caching", "async_support"], # ... }
-
Add tests in
tests/test_context_jargon.py
To add a new pattern:
-
Create pattern in
src/slop_detector/patterns/:class MyPattern(PatternDetector): def detect(self, tree: ast.AST) -> List[Issue]: # Implementation
-
Register in
src/slop_detector/patterns/registry.py -
Add tests in
tests/test_patterns.py
To add a new metric:
- Create metric in
src/slop_detector/metrics/my_metric.py - Update
FileAnalysismodel inmodels.py - Integrate in
core.py - Add tests in
tests/test_my_metric.py
# Documentation files
docs/
├── CONFIGURATION.md # Configuration guide
├── CLI_USAGE.md # CLI reference
├── CI_CD.md # CI/CD integration
└── DEVELOPMENT.md # This file
# Update README.md for major features- Clear, concise language
- Code examples for all features
- Link to related docs
- Keep examples up-to-date
Update version in:
pyproject.tomlsrc/slop_detector/__init__.pysrc/slop_detector/auth/__init__.py
Add entry to CHANGELOG.md:
## [X.Y.Z] - YYYY-MM-DD
### Added
- New feature
### Changed
- Updated behavior
### Fixed
- Bug fixgit tag -a vX.Y.Z -m "Release vX.Y.Z"
git push origin vX.Y.Z# Build package
python -m build
# Upload to PyPI
twine upload dist/*- Tests added/updated
- Coverage ≥ 80%
- Black formatted
- Ruff clean
- Documentation updated
- CHANGELOG updated
- No breaking changes (or documented)
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
Describe testing performed
## Checklist
- [ ] Tests pass
- [ ] Coverage maintained
- [ ] Docs updated- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: info@flamehaven.space
By contributing, you agree that your contributions will be licensed under the MIT License.
- CLI Usage - Command-line reference
- Configuration - Customize settings
- CI/CD Integration - Automated testing