Skip to content

21-reva/code-intelligence-analysis-platform

Repository files navigation

🚀 Code Intelligence & Analysis Platform

A Python-based Static Code Analysis Tool that analyzes Python source code using the Abstract Syntax Tree (AST) module. The platform evaluates code quality, software metrics, maintainability, security, and coding standards, and generates detailed reports in multiple formats.


✨ Features

📊 Code Metrics

  • Function Count
  • Class Count
  • Import Count
  • Total Lines of Code
  • Code, Blank and Comment Line Count
  • Cyclomatic Complexity
  • Function Complexity Analysis
  • File-wise Metrics

🔍 Code Quality Analysis

  • Duplicate Function Detection
  • Dead Code Detection
  • Unused Import Detection
  • Unused Variable Detection
  • Long Function Detection
  • Missing Docstring Detection
  • Naming Convention Checker
  • Function Argument Checker
  • Nested Loop Detection
  • Recursive Function Detection
  • Lambda Function Detection
  • Import Alias Detection

🛡️ Security Analysis

  • Hardcoded Password Detection
  • Empty Exception Handler Detection
  • Global Variable Detection
  • Magic Number Detection
  • Try Blocks Without Finally

🏗️ Object-Oriented Analysis

  • Classes Without __init__()
  • Large Class Detection
  • Classes With Too Many Methods
  • Inheritance Detection

📈 Reports Generated

  • HTML Dashboard
  • JSON Report
  • Summary Chart
  • Requirements File Generator
  • README Generator

📊 Example Analysis Result

The following report was generated by analyzing the sample project included in this repository.

Overall Code Health

Metric Value
Overall Score 84.83 / 100
Grade B
Complexity Rating Excellent
Maintainability Score 60.08
Security Score 96 / 100 (Excellent)

Project Summary

Metric Value
Functions 4
Classes 1
Imports 1
Total Lines 27
Code Lines 15
Blank Lines 12
Comment Lines 0
Complexity Score 1

Function Metrics

  • Largest Function: factorial() (4 lines)
  • Smallest Function: add() (2 lines)
  • Average Function Size: 2.50 lines

Issues Found

Category Count
Duplicate Functions 0
Unused Imports 1
Unused Variables 1
Missing Docstrings 4
Long Functions 0
Empty Exception Handlers 0
Global Variables 1
Dead Code 0
Hardcoded Passwords 0
Large Classes 0

Task Comments

  • TODO : 0
  • FIXME : 0
  • BUG : 0

Detected Third-Party Requirements

  • No third-party packages detected.

Note: These results are generated from the sample project (sample_projects/demo.py). Running the analyzer on another Python project will generate a different report.


🛠 Technologies Used

  • Python 3
  • Abstract Syntax Tree (AST)
  • JSON
  • HTML
  • Matplotlib

📂 Project Structure

Code Intelligence and Analysis Platform
│
├── src/
│   ├── analyzer.py
│   ├── metrics.py
│   ├── report_generator.py
│   ├── html_report.py
│   ├── json_report.py
│   └── ...
│
├── sample_projects/
│   └── demo.py
│
├── main.py
├── README.md
├── requirements.txt
├── report.html
├── report.json
└── summary_chart.png

▶️ How to Run

Clone the repository

git clone <repository-link>

Open the project

cd Code-Intelligence-and-Analysis-Platform

Install dependencies

pip install -r requirements.txt

Run the analyzer

python main.py

📄 Output Files

Running the project automatically generates:

  • report.html – Interactive HTML Dashboard
  • report.json – Machine-readable JSON Report
  • summary_chart.png – Visual Summary Chart

⚠️ Known Limitations

  • Supports Python projects only.
  • Duplicate detection identifies exact matches only.
  • Dynamic imports may not always be detected.
  • Dead code detection may report false positives for dynamically referenced code.

🚀 Future Improvements

  • PDF Report Generation
  • Streamlit Web Dashboard
  • VS Code Extension
  • GitHub Repository Analysis
  • AI-powered Code Review Suggestions

About

Python-based static code analysis platform using AST

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors