This repository provides scripts for analyzing and visualizing Python code through UML diagrams and code metrics. It is designed to aid in reverse engineering efforts by offering insights into code structure and maintainability.
Purpose: Generates a UML class diagram using pyreverse
.
-
How it works:
- Utilizes the
pyreverse
tool to analyze a Python file and produce class diagrams in PNG format. - Outputs are saved in a specified directory for easy access.
- Example: Analyzes relationships between classes and methods to visualize the code's structure.
- Utilizes the
-
Key Benefits:
- Quick and efficient generation of class diagrams.
- Ideal for understanding code relationships in a project.
Purpose: Creates both class and sequence diagrams using PlantUML
.
-
How it works:
- Transforms Python code into
PlantUML
format for visualization. - Users can generate class diagrams to understand structure and sequence diagrams to map the flow of interactions.
- Requires
PlantUML
installed on the system.
- Transforms Python code into
-
Key Benefits:
- Offers additional sequence diagrams for a deeper analysis of program flow.
- Flexible and supports custom UML needs.
Purpose: Calculates cyclomatic complexity, maintainability index, and other metrics.
-
How it works:
- Analyzes a Python file to compute:
- Lines of Code (LOC): Total lines in the file.
- Cyclomatic Complexity: Measures code complexity for readability and maintainability.
- Maintainability Index (MI): Indicates how easy the code is to maintain.
- Halstead Metrics: Analyzes operations and operands in the code.
- Saves results in a JSON file for review.
- Analyzes a Python file to compute:
-
Key Benefits:
- Helps in assessing the quality and maintainability of code.
- Useful for identifying areas that may need refactoring.
- Python Dependencies:
Install required Python packages usingpip
:pip install pylint plantuml radon