πΊπΈ English | π¨π³ δΈζ | π«π· FranΓ§ais | π·πΊ Π ΡΡΡΠΊΠΈΠΉ | π―π΅ ζ₯ζ¬θͺ | π©πͺ Deutsch | π°π· νκ΅μ΄ | π΅πΉ PortuguΓͺs | ππ° ηΉι«δΈζ(ι¦ζΈ―) | πΉπΌ ηΉι«δΈζ(ε°η£)
A powerful code analysis tool for analyzing project code volume, language distribution, file structure, and dependencies.
Features β’ Quick Start β’ Usage Guide β’ API Documentation β’ Contributing
- Features
- System Requirements
- Installation
- Quick Start
- Usage Guide
- API Documentation
- Project Structure
- Tech Stack
- Configuration
- FAQ
- Contributing
- License
- Multi-language Support: Supports code analysis for 30+ programming languages
- Detailed Statistics: Provides total lines, code lines, comment lines, and blank lines statistics
- Language Distribution: Visual display of programming language proportions and distribution
- File Structure: Detailed file list and directory structure analysis
- Pie Charts: Language distribution visualization
- Bar Charts: Code line statistics comparison
- Interactive Charts: Dynamic chart display based on Chart.js
- Internal Dependencies: Analyze dependency relationships between internal project modules
- External Dependencies: Identify third-party libraries and framework dependencies
- Circular Dependency Detection: Automatically detect and report circular dependency issues
- Dependency Graph: Visualize dependency relationship networks
- Smart Path Completion: Real-time path auto-completion functionality
- Drag & Drop Support: Support for dragging folders for analysis
- History Records: Automatically save recently analyzed projects
- Quick Access: Quick access buttons for common directories
- Project Type Recognition: Automatically identify project types (Node.js, Python, Java, etc.)
- Multiprocessing: Support for multiprocess parallel analysis to improve processing speed
- Smart Exclusion: Automatically exclude irrelevant directories like node_modules, .git
- Progress Monitoring: Real-time display of analysis progress and processing status
- Memory Optimization: Optimized memory usage for large projects
- JSON Format: Export detailed analysis data
- HTML Reports: Generate visual HTML reports
- CSV Data: Export tabular data for further analysis
- Python: 3.7 or higher
- Operating System: Windows 10+, macOS 10.14+, Linux (Ubuntu 18.04+)
- Memory: 4GB+ recommended
- Disk Space: At least 100MB available space
- Clone the project
git clone https://github.com/your-username/code-analyzer.git
cd code-analyzer- Run the startup script
python start.pyThe startup script will automatically:
- Check Python version
- Install required dependencies
- Create necessary directories
- Start the web service
- Clone the project
git clone https://github.com/your-username/code-analyzer.git
cd code-analyzer- Create virtual environment (optional but recommended)
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Start the service
python app.py-
Start the service
python start.py
-
Open browser Visit
http://localhost:5001 -
Select project
- Enter project path
- Or use quick access buttons
- Or drag folder to input box
-
Start analysis Click "Start Analysis" button and wait for completion
-
View results
- View statistical overview
- Browse visualization charts
- Analyze dependencies
- Export analysis reports
- π₯οΈ Desktop: Quick access to desktop directory
- π Documents: Quick access to documents directory
- β¬οΈ Downloads: Quick access to downloads directory
- π± Applications: Quick access to applications directory
- Path Completion: Auto-complete suggestions when entering paths
- Drag & Drop Support: Directly drag folders to input box
- History Records: Automatically save recently analyzed projects
The system automatically recognizes project types:
- π¦ Node.js: Detects
package.json - π Python: Detects
requirements.txt - β Java Maven: Detects
pom.xml - π Java Gradle: Detects
build.gradle - π¦ Rust: Detects
Cargo.toml - πΉ Go: Detects
go.mod - π Ruby: Detects
Gemfile - π· C#: Detects
.csproj - βοΈ C/C++: Detects
CMakeLists.txt
- Enable Multiprocessing: Utilize multi-core CPU for accelerated analysis
- Process Count Setting: Manual setting or automatic detection of optimal process count
- Memory Management: Automatic memory usage optimization
- Exclude Directories: Automatically exclude
node_modules,.git,__pycache__, etc. - File Filtering: Support filtering by file type and size
- Encoding Detection: Automatic file encoding detection
- Total Files: Total number of files in the project
- Total Lines: Sum of lines in all files
- Code Lines: Pure code lines (excluding comments and blank lines)
- Programming Languages: Number of detected programming languages
- Language Distribution Pie Chart: Proportion of each language's code
- Code Lines Bar Chart: Comparison of code lines by language
- Interactive Features: Click legend to hide/show corresponding data
- Internal Dependencies: Reference relationships between project modules
- External Dependencies: Usage of third-party libraries and frameworks
- Circular Dependencies: Detect and highlight circular dependencies
- Complexity Assessment: Evaluate project complexity based on dependencies
Supports multiple format data exports:
- JSON Format: Complete analysis data, suitable for programmatic processing
- HTML Reports: Visual reports with charts
- CSV Data: Tabular format, suitable for Excel and other tools
POST /api/analyze
Content-Type: application/json
{
"project_path": "/path/to/project",
"use_multiprocessing": true,
"max_workers": 4
}GET /api/progressPOST /api/validate_path
Content-Type: application/json
{
"path": "/path/to/validate"
}POST /api/autocomplete_path
Content-Type: application/json
{
"path": "/partial/path"
}POST /api/export
Content-Type: application/json
{
"format": "json|html|csv",
"data": { /* analysis result data */ }
}GET /api/download/<filename>GET /api/system_infoGET /api/recent_projectscode-analyzer/
βββ app.py # Flask web application main file
βββ code_analyzer.py # Core analysis engine
βββ start.py # Startup script
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation (Chinese)
βββ README_EN.md # Project documentation (English)
βββ static/ # Static resources directory
β βββ css/
β β βββ style.css # Style file
β βββ js/
β βββ app.js # Frontend JavaScript
βββ templates/ # HTML template directory
β βββ index.html # Main page template
βββ exports/ # Export files directory
- Flask application configuration and routing
- API interface implementation
- File upload and download handling
- Error handling and logging
- Multi-language code analysis
- File statistics and line counting
- Dependency relationship analysis
- Multiprocess parallel processing
- Environment checking and dependency installation
- Automated deployment process
- System compatibility detection
static/js/app.js: Frontend interaction logicstatic/css/style.css: Interface style designtemplates/index.html: Page structure template
- Python 3.7+: Main programming language
- Flask 2.3.3: Web framework
- Flask-CORS: Cross-origin request support
- chardet: Character encoding detection
- Pygments: Syntax highlighting support
- HTML5: Page structure
- CSS3: Style design (responsive layout support)
- JavaScript ES6+: Interaction logic
- Chart.js: Data visualization
- Font Awesome: Icon library
- Multiprocess Parallel Processing: Using Python multiprocessing
- AST Syntax Analysis: Based on Python ast module
- Regular Expression Matching: Multi-language import/include detection
- Graph Algorithms: Dependency relationships and cycle detection
The system supports analysis of the following programming languages:
| Language | File Extensions | Feature Support |
|---|---|---|
| Python | .py, .pyw, .pyx |
β Dependency Analysis |
| JavaScript | .js, .jsx, .mjs |
β Dependency Analysis |
| TypeScript | .ts, .tsx |
β Dependency Analysis |
| Java | .java |
β Dependency Analysis |
| C++ | .cpp, .cc, .cxx, .hpp |
β Dependency Analysis |
| C | .c, .h |
β Dependency Analysis |
| C# | .cs |
β Dependency Analysis |
| Go | .go |
β Dependency Analysis |
| Rust | .rs |
|
| PHP | .php, .phtml |
|
| Ruby | .rb |
|
| Swift | .swift |
|
| Kotlin | .kt, .kts |
|
| HTML | .html, .htm |
|
| CSS | .css, .scss, .sass |
|
| Others | More formats... |
The following directories and files are excluded by default:
Directory Exclusions:
node_modules/- Node.js dependencies.git/- Git version control__pycache__/- Python cachevenv/,env/- Python virtual environmentsbuild/,dist/- Build outputs.idea/,.vscode/- IDE configurationstarget/- Java build output
File Exclusions:
.DS_Store- macOS system filesThumbs.db- Windows thumbnails*.lock- Lock files.gitignore- Git ignore files
Performance can be adjusted with the following parameters:
# Multiprocessing settings
use_multiprocessing = True # Whether to enable multiprocessing
max_workers = None # Maximum number of processes (None for auto-detection)
# File size limits
max_file_size = 10 * 1024 * 1024 # 10MB
# Timeout settings
analysis_timeout = 300 # 5 minutesA:
- Enable multiprocessing
- Exclude unnecessary large directories
- Check disk space and memory usage
- Consider batch analysis for large projects
A:
- Check if file extensions are in the supported list
- Ensure files are not in excluded directories
- Check if file encoding is correct
- Verify file size doesn't exceed limits
A:
- Ensure project structure is complete
- Check import statement formats
- Some dynamic imports may not be detected
- Complex conditional imports may be ignored
A:
- Reduce concurrent process count
- Exclude large files and directories
- Process large projects in batches
- Increase system memory
A:
- Add file extensions to
language_extensions - Add import patterns to
import_patterns(optional) - Test and submit a Pull Request
We welcome all forms of contributions!
-
Fork the project
git clone https://github.com/your-username/code-analyzer.git
-
Create feature branch
git checkout -b feature/amazing-feature
-
Commit changes
git commit -m 'Add some amazing feature' -
Push branch
git push origin feature/amazing-feature
-
Create Pull Request
- π Bug Fixes: Report and fix issues
- β¨ New Features: Add new analysis features
- π Documentation: Improve documentation and examples
- π¨ Interface: Optimize user interface and experience
- β‘ Performance: Improve analysis speed and efficiency
- π Internationalization: Add multi-language support
-
Install development dependencies
pip install -r requirements.txt pip install pytest black flake8 # Development tools -
Run tests
pytest tests/
-
Code formatting
black . flake8 .
- Follow PEP 8 Python code standards
- Use meaningful variable and function names
- Add appropriate comments and docstrings
- Write unit tests covering new features
- Maintain backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
Thanks to the following open source projects for their support:
- Flask - Web framework
- Chart.js - Chart library
- Font Awesome - Icon library
- chardet - Encoding detection
- Pygments - Syntax highlighting
- Project Homepage: https://github.com/your-username/code-analyzer
- Issue Reports: https://github.com/your-username/code-analyzer/issues
- Feature Requests: https://github.com/your-username/code-analyzer/discussions
If this project helps you, please give us a β Star!