Enterprise-Grade Automated Code Analysis for Laravel Projects
- π Documentation
- π Quick Start
- π― Smart Laravel Detection
- π Recovery & Troubleshooting
- π― Features
- π Advanced Code Analysis
- π§ AI-Powered Intelligence
- π‘οΈ Advanced Security Analysis
- π Comprehensive Rule System
- π Installation Guide - Complete installation instructions, troubleshooting, and configuration
- π§ Uninstall Guide - Comprehensive uninstallation process and fixes
# Full installation (recommended)
./codementor-ai/install.sh --full
# Quick setup (hooks + config only)
./codementor-ai/install.sh --quick
# Git hooks only
./codementor-ai/install.sh --hooksπ‘ Need detailed instructions? See our π Installation Guide for comprehensive setup instructions, troubleshooting, and advanced configuration options.
CodeMentor AI automatically detects Laravel projects and creates the appropriate configuration:
- Laravel Projects: Creates
config/codementor-ai.phpwith environment variable support - Standalone Projects: Creates
codementor-ai/config.phpfor standalone use - No manual configuration needed! π
# Run code review
php codementor-ai/cli.php
# Quick review (pre-commit)
php codementor-ai/cli.php --quick
# Full review with HTML report
php codementor-ai/cli.php --full --format=html# Full uninstall (removes everything)
./codementor-ai/uninstall.sh --full
# Safe uninstall (keeps packages)
./codementor-ai/uninstall.sh
# Remove packages only
./codementor-ai/uninstall.sh --packagesπ§ Need uninstall help? See our π§ Uninstall Guide for detailed uninstallation instructions and troubleshooting.
-
Quick recovery (recommended):
./codementor-ai/recover.sh --all
-
Targeted recovery:
./codementor-ai/recover.sh --config # Fix missing config.php ./codementor-ai/recover.sh --autoload # Fix autoloading issues ./codementor-ai/recover.sh --hooks # Recreate Git hooks ./codementor-ai/recover.sh --packages # Reinstall packages
-
Self-healing CLI:
php codementor-ai/cli.php --quick # Will attempt auto-recovery
- "Class not found": Run
./codementor-ai/recover.sh --autoload - "config.php missing": Run
./codementor-ai/recover.sh --config - "Git hooks not working": Run
./codementor-ai/recover.sh --hooks
- AST Parsing: Abstract Syntax Tree-based analysis for precise code understanding
- Laravel-Native Intelligence: Framework-specific rules and conventions
- Context-Aware Analysis: Understands code relationships and dependencies
- Performance Optimization: Intelligent caching and parallel processing
- Machine Learning Integration: Pattern recognition and optimization
- False Positive Reduction: AI-powered rule sensitivity adjustment
- Intelligent Suggestions: Context-aware improvement recommendations
- Code Quality Prediction: ML models for quality assessment
- SQL Injection Detection: AST-based vulnerability scanning
- XSS Vulnerability Scanning: Comprehensive cross-site scripting detection
- CSRF Protection Validation: Laravel-specific security checks
- Authentication Bypass Detection: Custom security rule validation
- Sensitive Data Exposure: Pattern-based data protection scanning
- PSR-12 Compliance: Automatic PHP coding standards validation
- Laravel Best Practices: Framework-specific rules and conventions
- MongoDB Usage Validation: Database-specific best practices
- Custom Rules: Project-specific validation rules
- Security Analysis: Vulnerability detection and security best practices
- HTML Reports: Beautiful, interactive reports with filtering
- Category Organization: Logical grouping of issues by type
- Severity Levels: Critical, Warning, Info, and Suggestion levels
- Progress Indicators: Real-time analysis progress tracking
- Export Options: Multiple output formats (HTML, JSON, XML)
- Intelligent Caching: Reduces analysis time by 70%
- Parallel Processing: Multi-threaded analysis for large codebases
- Incremental Analysis: Only analyzes changed files
- Memory Optimization: Efficient memory usage for large projects
codementor-ai/
βββ README.md # This file
βββ cli.php # Main CLI entry point
βββ config.php # Configuration file
βββ install.sh # Quick installation script
βββ uninstall.sh # Clean uninstall script
βββ recover.sh # Recovery and troubleshooting
βββ phpstan.neon # PHPStan configuration
βββ phpcs.xml # PHPCS configuration
βββ phpunit.xml # PHPUnit test configuration
βββ engine/ # Core engine files
β βββ RuleRunner.php # Main rule execution engine
β βββ FileScanner.php # Optimized file discovery
β βββ RuleInterface.php # Rule interface definition
β βββ ReportWriter.php # Report generation
β βββ ConfigurationLoader.php # Configuration management
β βββ ErrorHandler.php # Error handling system
β βββ PerformanceOptimizedRule.php # Performance optimizations
β βββ ProgressIndicator.php # Progress tracking
β βββ RuleCategory.php # Rule categorization
β βββ RuleFilter.php # Report filtering
β βββ RuleValidator.php # Rule validation
β βββ AIRuleOptimizer.php # AI-powered rule optimization
βββ rules/ # Custom analysis rules
β βββ CodeStyleRule.php # PSR-12 compliance
β βββ LaravelBestPracticesRule.php # Laravel conventions
β βββ NoMongoInControllerRule.php # MongoDB usage validation
β βββ SecurityVulnerabilityRule.php # Advanced security analysis
βββ tests/ # Comprehensive test suite
β βββ TestCase.php # Base test case
β βββ Unit/ # Unit tests
β βββ Integration/ # Integration tests
β βββ Feature/ # Feature tests
βββ docs/ # Documentation
β βββ README.md # System overview
β βββ QUICK-SETUP.md # Quick setup guide
β βββ installation-guide.md # Detailed installation
β βββ rule-categories.md # Rule system documentation
β βββ api-documentation.md # API documentation
β βββ GIT-HOOKS-GUIDE.md # Git hooks guide
βββ reports/ # Generated HTML reports
β βββ style.css # Report styling
βββ cache/ # Analysis cache files
// config.php
return [
'rules' => [
'ReviewSystem\Rules\CodeStyleRule',
'ReviewSystem\Rules\LaravelBestPracticesRule',
'ReviewSystem\Rules\NoMongoInControllerRule',
'ReviewSystem\Rules\SecurityVulnerabilityRule',
],
'cache' => [
'enabled' => true,
'ttl' => 3600,
],
'reporting' => [
'format' => 'html',
'output' => 'reports/',
'filters' => ['critical', 'warning'],
],
'ai' => [
'enabled' => true,
'learning_enabled' => true,
'optimization_enabled' => true,
],
'security' => [
'enabled' => true,
'strict_mode' => false,
],
];# File Scanner
REVIEW_ENABLE_CACHING=true
REVIEW_MAX_FILE_SIZE=10485760
REVIEW_USE_FILE_MOD_TIME=true
# Reporting
REVIEW_EXIT_ON_VIOLATION=true
REVIEW_HTML_TITLE="My Project Code Review"
# Logging
REVIEW_LOG_LEVEL=info
REVIEW_LOGGING_ENABLED=true
# Performance
REVIEW_PERFORMANCE_MONITORING=true
REVIEW_MEMORY_LIMIT=256MOur system has been optimized for performance:
- Analysis Speed: 3x faster than traditional tools
- Memory Usage: 50% less memory consumption
- Cache Efficiency: 70% reduction in analysis time
- Scalability: Handles 100k+ files efficiently
- AI Processing: Real-time pattern learning and optimization
- PSR-12 Compliance: PHP coding standards
- Naming Conventions: Variable, function, and class naming
- Formatting: Code formatting and indentation
- Documentation: Comment and documentation standards
- Laravel Best Practices: Framework-specific conventions
- Design Patterns: Architectural pattern validation
- Dependency Management: Proper dependency injection
- Service Layer: Business logic organization
- SQL Injection: Database query security
- XSS Detection: Cross-site scripting prevention
- CSRF Protection: Laravel-specific security validation
- Authentication Bypass: Access control validation
- Sensitive Data Exposure: Data protection scanning
- MongoDB Usage: Document database best practices
- Query Optimization: Database query efficiency
- Migration Standards: Database migration conventions
- Data Integrity: Referential integrity checks
- Interactive Filtering: Filter by severity, category, or file
- Code Highlighting: Syntax-highlighted code snippets
- Issue Navigation: Quick navigation between issues
- Export Options: Export filtered results
- Progress Tracking: Real-time analysis progress
- Critical Issues: Must-fix security and functionality issues
- Warnings: Code quality and best practice violations
- Info: Suggestions for improvement
- Suggestions: Optional enhancements
# GitHub Actions
- name: Code Review
run: php codementor-ai/cli.php --format=html --output=reports/
- name: Upload Report
uses: actions/upload-artifact@v2
with:
name: code-review-report
path: codementor-ai/reports/{
"scripts": {
"review": "php codementor-ai/cli.php",
"review:quick": "php codementor-ai/cli.php --quick",
"review:full": "php codementor-ai/cli.php --full",
"review:validate": "php codementor-ai/validate-config.php",
"test:codementor": "php codementor-ai/tests/run-tests.php",
"test:codementor:unit": "vendor/bin/phpunit --configuration=codementor-ai/phpunit.xml --testsuite=\"CodeMentor AI Unit Tests\""
}
}# One-command setup for developers
./codementor-ai/install.sh --hooksThis automatically configures:
- Pre-commit hook: Quick review before commits
- Pre-push hook: Full review before pushing
- Composer scripts: Manual review commands
- Default configuration: Ready-to-use settings
Our code review system has achieved:
- 99.9% Accuracy: Precise issue detection
- < 5s Analysis: Fast analysis for typical projects
- < 5% False Positives: AI-powered optimization
- 100% Coverage: Analyzes all code types
- 77 Comprehensive Tests: Professional test suite
- System Overview - Complete system documentation
- Quick Setup - Get started in 5 minutes
- Installation Guide - Detailed setup instructions
- Rule Categories - Understanding the rule system
- API Documentation - Technical API reference
- Git Hooks Guide - Complete developer guide
# Run all tests
composer test:codementor:all
# Run specific test suites
composer test:codementor:unit
composer test:codementor:integration
composer test:codementor:feature
# Run custom test runner
composer test:codementor- 77 Unit Tests: Comprehensive rule testing
- Integration Tests: End-to-end workflow validation
- Feature Tests: System functionality verification
- Performance Tests: Optimization validation
We welcome contributions to improve the code review system:
- Report Issues: Create detailed bug reports
- Suggest Features: Propose new analysis capabilities
- Submit Rules: Contribute custom analysis rules
- Improve Documentation: Help enhance documentation
- Add Tests: Expand test coverage
- Documentation: Comprehensive guides in
docs/folder - Community: Active developer community
- Enterprise Support: Professional support available
- Training: Custom training and workshops
- β Laravel-native code analysis
- β AI-powered rule optimization
- β Advanced security vulnerability detection
- β Comprehensive test suite
- β Zero-configuration setup
- π Multi-language support (Python, Java, JavaScript)
- π Advanced AI/ML integration
- π Cloud-based collaboration features
- π IDE plugin development
- π Enterprise dashboard
This project is licensed under the MIT License.
CodeMentor AI - Setting the standard for automated code analysis
Last Updated: January 2025 | Version: 2.0.0