Usage Guide
Usage Guide
Learn how to use Codementor-AI to analyze your Laravel code and generate comprehensive reports.
Basic Usage
Codementor-AI provides a simple command-line interface for running code analysis:
# Basic analysis
php codementor-ai/cli.php
# Quick analysis (faster, fewer checks)
php codementor-ai/cli.php --quick
# Full analysis with all rules
php codementor-ai/cli.php --full
# Analysis with specific output format
php codementor-ai/cli.php --format=html
php codementor-ai/cli.php --format=json
php codementor-ai/cli.php --format=text
Command Line Options
Option | Description | Example |
---|---|---|
--quick |
Run quick analysis with essential rules only | php cli.php --quick |
--full |
Run comprehensive analysis with all rules | php cli.php --full |
--format |
Output format (html, json, text) | php cli.php --format=html |
--output |
Output file path | php cli.php --output=report.html |
--config |
Show current configuration | php cli.php --config |
--version |
Show version information | php cli.php --version |
Analysis Types
Quick Analysis
Quick analysis is designed for pre-commit hooks and fast feedback:
php codementor-ai/cli.php --quick
This includes:
- Basic syntax checking
- Critical security issues
- Major performance problems
- Essential Laravel best practices
Full Analysis
Full analysis provides comprehensive code review:
php codementor-ai/cli.php --full
This includes:
- All quick analysis checks
- Code style and formatting
- Advanced security analysis
- Performance optimization suggestions
- Custom rule evaluation
- Documentation quality checks
Output Formats
HTML Reports
Generate beautiful, interactive HTML reports:
php codementor-ai/cli.php --format=html --output=analysis-report.html
HTML reports include:
- Interactive navigation
- Code highlighting
- Filtering and sorting
- Export capabilities
JSON Output
For integration with other tools:
php codementor-ai/cli.php --format=json --output=results.json
Text Output
Simple text format for terminal or logs:
php codementor-ai/cli.php --format=text
Git Integration
Codementor-AI automatically integrates with Git hooks:
Pre-commit Hook
Runs quick analysis before each commit:
# Automatically runs during git commit
git commit -m "Your commit message"
Pre-push Hook
Runs full analysis before pushing to remote:
# Automatically runs during git push
git push origin main
Configuration
Customize Codementor-AI behavior through configuration:
// config/codementor-ai.php
return [
'rules' => [
'enabled' => ['security', 'performance', 'laravel'],
'disabled' => ['style'],
],
'output' => [
'format' => 'html',
'directory' => 'reports/',
],
'analysis' => [
'max_file_size' => '1MB',
'exclude_patterns' => ['vendor/*', 'node_modules/*'],
],
];
Interpreting Results
Issue Severity Levels
🔴 Critical
Security vulnerabilities, fatal errors, or major issues that must be fixed immediately.
🟠High
Performance issues, potential bugs, or violations of best practices that should be addressed.
🟡 Medium
Code style issues, minor optimizations, or suggestions for improvement.
🟢 Low
Informational messages, documentation suggestions, or minor style issues.
Best Practices
- Run quick analysis frequently: Use during development for immediate feedback
- Use full analysis for releases: Comprehensive review before deployment
- Review HTML reports: Detailed analysis with context and suggestions
- Integrate with CI/CD: Automated analysis in your deployment pipeline
- Customize rules: Adapt analysis to your project's specific needs
Next Steps
Now that you understand the basics:
- Learn about custom rules
- Configure your project settings
- Set up CI/CD integration
- Create team-specific analysis profiles