Performance analyzer that finds issues standard linters miss
aiBsCleaner - A high-performance static analyzer for Go that focuses on detecting performance bottlenecks, algorithmic complexity issues, and AI-generated anti-patterns.
aiBsCleaner identifies performance issues that standard linters don't catch:
- Algorithmic Complexity: O(nΒ²/nΒ³) loops, inefficient algorithms
- Memory Issues: Memory leaks, goroutine leaks, GC pressure
- Database Problems: N+1 queries, missing prepared statements
- Concurrency Issues: Race conditions, deadlocks, channel misuse
- AI-Generated Anti-patterns: Over-engineered solutions, unnecessary complexity
- Resource Management: Unclosed resources, defer overhead
Using Go:
go install github.com/SergeiSkv/AiBsCleaner@latestUsing Homebrew (macOS/Linux):
brew install SergeiSkv/tap/aibscleanerUsing Docker:
docker pull sergeiskv/aibscleaner:latest
docker run -v $(pwd):/workspace sergeiskv/aibscleaner .From Release (Linux/macOS/Windows):
# Download from GitHub Releases
wget https://github.com/SergeiSkv/AiBsCleaner/releases/latest/download/aibscleaner-linux-amd64
chmod +x aibscleaner-linux-amd64
sudo mv aibscleaner-linux-amd64 /usr/local/bin/aibscleaner# Analyze current directory
./aiBsCleaner .
# Analyze specific path
./aiBsCleaner ./src
# With configuration
./aiBsCleaner --config .aiBsCleaner.yaml .
# Enable cache for faster subsequent runs
./aiBsCleaner --enable-cache .
# JSON output for CI/CD
./aiBsCleaner --json .- 33 Specialized Analyzers covering performance, security, and code quality
- Test Coverage: 66.8% (analyzer: 82.9%, cache: 56.9%)
- Zero External Dependencies for core functionality
- Fast: Processes large codebases efficiently with caching
- Loop Analyzer: Detects nested loops, allocations in loops, O(nΒ²) complexity
- Memory Leak Analyzer: Finds goroutine leaks, unclosed resources
- GC Pressure Analyzer: Identifies excessive allocations
- Defer Optimization: Analyzes defer overhead in hot paths
- CPU Optimization: Cache-friendly struct layout suggestions
- String Analyzer: String concatenation in loops, builder usage
- Race Condition Analyzer: Unsafe concurrent access patterns
- Goroutine Analyzer: Goroutine leaks, unbounded goroutines
- Channel Analyzer: Deadlocks, unbuffered channels in hot paths
- Sync Pool Analyzer: sync.Pool usage optimization
- Database Analyzer: N+1 queries, SQL in loops, connection leaks
- HTTP Client Analyzer: Missing timeouts, connection reuse
- HTTP Reuse Analyzer: Connection pooling optimization
- Network Patterns: Efficient networking patterns
- AI Bullshit Analyzer: Over-engineered solutions, unnecessary complexity
- Interface Analyzer: Interface pollution, empty interfaces
- Reflection Analyzer: Reflection misuse, performance impact
- API Misuse Analyzer: Standard library misuse
- Crypto Analyzer: Weak crypto, insecure random
- Privacy Analyzer: PII exposure, sensitive data logging
- Context Analyzer: Context misuse, cancellation handling
- Error Handling: Error checking, panic recovery
Create .aiBsCleaner.yaml:
analyzers:
loop:
enabled: true
defer_optimization:
enabled: true
memory_leak:
enabled: true
ai_bullshit:
enabled: true
thresholds:
max_loop_depth: 3
max_complexity: 10
max_function_length: 50
paths:
exclude:
- vendor/
- testdata/
- "*.pb.go"
- "*_test.go"
output:
format: text # or: json, compact
show_context: falseAnalyzing project...
Found 42 issues
HIGH SEVERITY (5)
ββββββββββββββββββββββββββββββββββββββββ
loop_analyzer.go:124 NESTED_LOOP_O_N3
Triple nested loop detected: O(nΒ³) complexity
Suggestion: Consider using hash map for O(n) lookup
PVE-001
database.go:67 N_PLUS_ONE_QUERY
Query in loop: SELECT * FROM users WHERE id = ?
Suggestion: Use JOIN or batch loading
PVE-130
MEDIUM SEVERITY (18)
ββββββββββββββββββββββββββββββββββββββββ
handler.go:45 ALLOC_IN_LOOP
Allocation inside loop may cause GC pressure
Suggestion: Preallocate slice with make()
PVE-001
AI BULLSHIT DETECTED (12)
ββββββββββββββββββββββββββββββββββββββββ
utils.go:23 OVERENGINEERED_SIMPLE
20 lines to check if number is even
Suggestion: Just use: n%2 == 0
PVE-201
# All tests
go test ./...
# With coverage
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
# Specific package
go test ./analyzer -v# Build binary
go build -o aiBsCleaner .
# Run linter
golangci-lint run ./...
# Run on self
./aiBsCleaner .- Fast Analysis: Processes ~1000 files/second
- Smart Caching: 10x faster on subsequent runs
- Low Memory: <100MB for most projects
- Parallel Processing: Utilizes multiple cores
- β 33 production-ready analyzers
- β Test coverage improvements (66.8%)
- β Dead code removal
- β Cache system with deadlock fixes
- β CI/CD pipeline with GitHub Actions
- β GoReleaser for automated releases
- β Docker support
- β Multi-platform builds (Linux/macOS/Windows)
- β Security scanning with Gosec
- β Comprehensive documentation
- IDE integrations (VS Code, GoLand)
- Auto-fix suggestions
- HTML/SARIF report formats
- More analyzers (additional crypto patterns)
- Performance benchmarking suite
- GitHub App integration
Contributions welcome! See CONTRIBUTING.md for details.
Areas of focus:
- New Analyzers: Add performance detectors
- Test Coverage: Improve from 66.8% to 85%+
- Documentation: Usage examples, best practices
- Bug Reports: Real-world testing feedback
Quick start:
git clone https://github.com/SergeiSkv/AiBsCleaner.git
cd AiBsCleaner
make setup
make testMIT License - see LICENSE file
- Go team for excellent static analysis tools
- Community for feedback and contributions
- All developers fighting performance issues
- Performance Error Catalog - All PVE codes
- PVE Codes Reference - Detailed error descriptions
- Contributing Guide - How to contribute
- Changelog - Release history
- Testing Documentation - Test guides
Find performance issues before they find production π