CodePure is an advanced VS Code extension that detects and highlights code smells using extracted metrics. It leverages Tree-sitter for code extraction, processes the data into JSON, and applies iPlasma-inspired rules to identify problematic code structures.
CodePure analyzes your code and visually highlights problematic sections based on defined metrics:
- Brain Class
- Highlights based on WMC > 87 (method heads) and LOC > 351 (class head).
- Provides messages suggesting code improvements.
- Data Class
- Detects classes with minimal behavior (low method complexity, high attribute usage).
- God Class
- Flags excessively large classes with high complexity and responsibility.
- Schizo Class (Future Testing Needed)
- Identifies classes with conflicting responsibilities.
- Automatically suggests refactoring solutions for detected code smells.
- Helps developers quickly improve code quality with minimal manual effort.
- Real-time visual cues for detected code smells.
- Different colors and markers for various issues, ensuring quick identification.
CodePure retrieves metrics from a precomputed JSON file instead of recalculating them, improving efficiency. Extracted metrics include:
- WMC (Weighted Methods per Class)
- LOC (Lines of Code)
- NrBm (Number of Brain Methods)
- CBO (Coupling Between Objects)
- NOA (Number of Attributes)
- Generates a comprehensive class diagram for the entire project.
- Uses the extracted JSON data to visualize class structures and relationships.
- Uses Tree-sitter to extract code structure.
- Saves extracted data in JSON format for easy readability and further processing.
- Powers a Class Diagram Generator using the parsed JSON data.
- The AI model was trained by us specifically for CodePure.
- Optimized for detecting Brain Class, Data Class, God Class, and Schizo Class.
- Continuously improved based on real-world testing.
CodePure was tested on medium-sized GitHub repositories:
- ✅ Data Class detection: Always accurate.
- ⚖ God Class detection: 50% accuracy.
- 🔬 Further testing required for Brain Class & Schizo Class.
- Download the extension from the VS Code Marketplace (link to be added).
- Open VS Code and navigate to Extensions.
- Search for CodePure and install.
- Restart VS Code if necessary.
- Open a project in VS Code.
- CodePure automatically detects and highlights code smells.
- Use Quick AI Fix to resolve issues faster.
- Generate a Class Diagram for a better project overview.
- Check the provided messages and refactor accordingly.
- ✅ Current Features: Brain Class, Data Class, God Class detection.
- 🛠 In Progress: Schizo Class detection improvements.
- 🔍 Future: Enhanced visualization & customization options.
We welcome contributions! Feel free to:
- Submit issues on GitHub
- Suggest improvements & optimizations in our feedback in the extension itself
- Help refine detection accuracy with new test cases
Code smarter with CodePure! 🚀
