# wei-code-annotation-analyzer **Repository Path**: zhaowei23/wei-code-annotation-analyzer ## Basic Information - **Project Name**: wei-code-annotation-analyzer - **Description**: 代码注释率分析工具 - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2026-01-20 - **Last Updated**: 2026-01-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Code Annotation Analyzer A tool for analyzing and detecting the quality of code comments, supporting multiple file formats. It can identify valid comments, commented-out code, and redundant comments, and provides detailed analysis reports. ## Features - **Multi-format Support**: Supports comment analysis for common code files such as Java, XML, SQL, and Properties - **Comment Classification**: Automatically distinguishes between valid comments, commented-out code, and meaningless comments - **Redundancy Detection**: Intelligent detection of redundant content such as trivial translations, Getter/Setter comments, etc. - **GUI Interface**: Provides an intuitive graphical interface for selecting files/folders to analyze - **Report Export**: Supports exporting detailed analysis reports in Excel and CSV formats - **Statistical Analysis**: Aggregates statistics by file type, including overall comment rate ## Supported File Types | File Type | Description | |-----------|-------------| | `.java` | Java source code files | | `.xml` | XML configuration files (including MyBatis mapping files) | | `.sql` | SQL script files | | `.properties` | Java configuration files | | `.yml` / `.yaml` | YAML configuration files | ## Quick Start ### Prerequisites - JDK 8 or higher - Maven 3.6+ ### Build the Project ```bash # Clone the project git clone https://gitee.com/zhaowei23/wei-code-annotation-analyzer.git # Enter the project directory cd wei-code-annotation-analyzer # Build with Maven ./mvnw clean package ``` ### Run the Application ```bash # Run with Maven ./mvnw spring-boot:run # Or run the packaged JAR file directly java -jar target/code-annotation-analyzer-*.jar ``` ## Usage Instructions 1. **Launch the Application**: After running the program, the graphical interface will open automatically 2. **Select Files/Folders**: - Click "Select File" to analyze a single source code file - Click "Select Folder" to analyze an entire project directory 3. **View Results**: After analysis completes, view detailed statistics for each file in the table 4. **Export Report**: Click the "Export Excel" or "Export CSV" button to generate the analysis report ## Analysis Metrics | Metric | Description | |--------|-------------| | Total Lines | Total number of lines in the file (including code, comments, and blank lines) | | Code Lines | Number of actual code lines | | Valid Comment Lines | Meaningful explanatory comments | | Commented-Out Code Lines | Lines of code that have been commented out | | Blank Lines | Number of empty lines | | Comment Rate | Ratio of valid comment lines to total code lines | ## Project Structure ``` src/main/java/com/wei/CodeAnnotationAnalyzer/ ├── analyzer/ # Comment analyzers for various file types │ ├── JavaCommentAnalyzer.java │ ├── XmlCommentAnalyzer.java │ ├── PropertiesCommentAnalyzer.java │ ├── SqlCommentAnalyzer.java │ └── RedundantCommentDetector.java ├── model/ # Data models │ ├── FileAnalysisResult.java │ └── FolderAnalysisResult.java ├── service/ # Business services │ ├── FolderScanService.java │ └── ReportExportService.java ├── ui/ # Graphical user interface │ └── CommentAnalyzerApp.java └── CodeAnnotationAnalyzerApplication.java ``` ## Technology Stack - **Spring Boot**: Application framework - **JavaFX**: Graphical user interface - **Apache POI**: Excel report export - **Regular Expressions**: Comment pattern matching ## License This project is open-source under the MIT License. See the [LICENSE](LICENSE) file for details.