CodeLLaMA-Linux-BugFix / PROJECT_STRUCTURE.md
Mac Huang
Push full project including dataset, code, and training scripts
ed6b901
|
raw
history blame
8.18 kB
# Linux Kernel Anti-Pattern Detector - Project Structure
## Overview
This project is organized into a clear, maintainable structure that separates concerns and makes it easy to find, modify, and extend functionality.
## Directory Structure
```
Linux Kernel Anti-Pattern Detector/
β”œβ”€β”€ πŸ“ data/ # Analysis data and results
β”‚ β”œβ”€β”€ results.json # Main analysis results
β”‚ β”œβ”€β”€ concurrency_analysis_report.json
β”‚ └── kernel_analysis.log # Analysis logs
β”‚
β”œβ”€β”€ πŸ“ docs/ # Documentation
β”‚ β”œβ”€β”€ kernel-analysis-guide.md # Kernel analysis documentation
β”‚ └── [additional documentation]
β”‚
β”œβ”€β”€ πŸ“ examples/ # Example code and usage
β”‚ └── [example files]
β”‚
β”œβ”€β”€ πŸ“ reports/ # Generated analysis reports
β”‚ β”œβ”€β”€ Linux_Kernel_Anti_Pattern_Analysis_Report.md
β”‚ β”œβ”€β”€ Executive_Summary.md
β”‚ └── πŸ“ concurrency/ # Concurrency-specific reports
β”‚ └── Concurrency_Analysis_Report.md
β”‚
β”œβ”€β”€ πŸ“ scripts/ # Analysis and utility scripts
β”‚ β”œβ”€β”€ πŸ“ analysis/ # Core analysis scripts
β”‚ β”‚ β”œβ”€β”€ concurrency_analyzer.py # Concurrency issue analyzer
β”‚ β”‚ └── analyze_kernel_structure.py
β”‚ β”œβ”€β”€ πŸ“ reporting/ # Report generation scripts
β”‚ β”‚ └── view_results.py # Results viewer
β”‚ └── πŸ“ utils/ # Utility scripts
β”‚ └── quick_summary.py # Quick summary generator
β”‚
β”œβ”€β”€ πŸ“ src/ # Source code (main project)
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ πŸ“ detectors/ # Anti-pattern detection modules
β”‚ β”œβ”€β”€ πŸ“ rules/ # Detection rules and patterns
β”‚ └── πŸ“ utils/ # Utility functions
β”‚
β”œβ”€β”€ πŸ“ tests/ # Test files
β”‚ └── [test files]
β”‚
β”œβ”€β”€ πŸ“ tools/ # Analysis tools and detectors
β”‚ β”œβ”€β”€ πŸ“ detectors/ # Main detection tools
β”‚ β”‚ β”œβ”€β”€ detector.py # Main anti-pattern detector
β”‚ β”‚ └── config.yaml # Detection configuration
β”‚ β”œβ”€β”€ πŸ“ visualizers/ # Data visualization tools
β”‚ └── πŸ“ exporters/ # Data export tools
β”‚
β”œβ”€β”€ πŸ“ linux/ # Linux kernel source (cloned)
β”‚ └── [kernel source files]
β”‚
β”œβ”€β”€ πŸ“„ README.md # Main project documentation
β”œβ”€β”€ πŸ“„ requirements.txt # Main project dependencies
β”œβ”€β”€ πŸ“„ requirements-kernel-analysis.txt
β”œβ”€β”€ πŸ“„ requirements-simple.txt
β”œβ”€β”€ πŸ“„ .gitignore # Git ignore rules
└── πŸ“„ PROJECT_STRUCTURE.md # This file
```
## Directory Descriptions
### πŸ“ data/
Contains all analysis results, logs, and generated data files.
- **results.json**: Complete analysis results from the main detector
- **concurrency_analysis_report.json**: Detailed concurrency analysis
- **kernel_analysis.log**: Analysis execution logs
### πŸ“ docs/
Project documentation and guides.
- **kernel-analysis-guide.md**: Comprehensive guide for kernel analysis
- Additional documentation for specific features
### πŸ“ examples/
Example code, usage patterns, and sample data.
- Example kernel modules for testing
- Sample configuration files
- Usage examples
### πŸ“ reports/
Generated analysis reports in various formats.
- **Linux_Kernel_Anti_Pattern_Analysis_Report.md**: Complete technical report
- **Executive_Summary.md**: High-level summary for stakeholders
- **concurrency/**: Specialized reports for specific issue types
### πŸ“ scripts/
Analysis and utility scripts organized by function.
#### πŸ“ analysis/
Core analysis scripts for different types of anti-patterns.
- **concurrency_analyzer.py**: Specialized concurrency issue analysis
- **analyze_kernel_structure.py**: Kernel structure analysis
#### πŸ“ reporting/
Scripts for generating and viewing reports.
- **view_results.py**: Interactive results viewer and reporter
#### πŸ“ utils/
Utility scripts for common tasks.
- **quick_summary.py**: Quick summary generation
### πŸ“ src/
Main project source code (core framework).
- **detectors/**: Anti-pattern detection modules
- **rules/**: Detection rules and pattern definitions
- **utils/**: Utility functions and helpers
### πŸ“ tests/
Test files and test data.
- Unit tests for detection modules
- Integration tests
- Test data and fixtures
### πŸ“ tools/
Analysis tools and detectors.
#### πŸ“ detectors/
Main detection tools and configurations.
- **detector.py**: Primary anti-pattern detection engine
- **config.yaml**: Detection configuration and rules
#### πŸ“ visualizers/
Data visualization and charting tools.
- Interactive dashboards
- Chart generators
- Data plotting utilities
#### πŸ“ exporters/
Data export and format conversion tools.
- JSON to other formats
- Report generation
- Data transformation
### πŸ“ linux/
Cloned Linux kernel source code for analysis.
- Complete kernel source tree
- Used for code snippet extraction
- Reference for pattern validation
## File Descriptions
### Core Files
- **README.md**: Main project documentation and getting started guide
- **requirements.txt**: Main project Python dependencies
- **requirements-kernel-analysis.txt**: Kernel analysis specific dependencies
- **requirements-simple.txt**: Simplified dependencies for basic usage
- **.gitignore**: Git ignore patterns for the project
### Configuration Files
- **tools/detectors/config.yaml**: Main detection configuration
- **tools/detectors/detector.py**: Primary detection engine
## Usage Patterns
### Running Analysis
```bash
# Main analysis
python tools/detectors/detector.py --clone --output data/results.json
# Concurrency analysis
python scripts/analysis/concurrency_analyzer.py
# View results
python scripts/reporting/view_results.py data/results.json
```
### Generating Reports
```bash
# Quick summary
python scripts/utils/quick_summary.py
# Interactive viewer
python scripts/reporting/view_results.py --interactive
```
### Development
```bash
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-kernel-analysis.txt
# Run tests
python -m pytest tests/
# Development setup
conda activate linux-kernel-anti-pattern-detector
```
## Best Practices
### Adding New Features
1. **Analysis scripts**: Add to `scripts/analysis/`
2. **Reporting tools**: Add to `scripts/reporting/`
3. **Utilities**: Add to `scripts/utils/`
4. **Core detection**: Add to `src/detectors/`
5. **Configuration**: Update `tools/detectors/config.yaml`
### File Naming Conventions
- **Python files**: snake_case (e.g., `concurrency_analyzer.py`)
- **Configuration files**: kebab-case (e.g., `kernel-analysis-guide.md`)
- **Reports**: Pascal_Case (e.g., `Concurrency_Analysis_Report.md`)
### Data Management
- **Raw data**: Store in `data/`
- **Processed results**: Store in `data/`
- **Reports**: Generate in `reports/`
- **Logs**: Store in `data/`
## Maintenance
### Regular Tasks
1. **Update dependencies**: Review and update requirements files
2. **Clean data**: Remove old analysis results periodically
3. **Update kernel**: Refresh the Linux kernel source
4. **Backup reports**: Archive important analysis reports
### Version Control
- **Track**: Source code, configuration, documentation
- **Ignore**: Analysis results, logs, kernel source (large files)
- **Archive**: Important reports and findings
---
*This structure is designed to be scalable, maintainable, and easy to navigate. Each directory has a clear purpose and the organization supports both development and research workflows.*