CoDiver README

项目的 README,来自 github.com/AhmadHassan-BTed/CoDiver。合并为一个 markdown 文件:README.md。

CoDiver: Code Sniffer & Project Analyzer

An advanced, open-source unified platform for code quality, architecture metrics, and Agile analytics.

Version License Open Source Streamlit Python Live Demo

[!NOTE] This project was previously known as SMC-Software-Metrics-Calculator.


The Philosophy

Software is inherently human. Behind every line of code, every architectural decision, and every sprint metric lies human effort and engineering intent. The CoDiver: Code Sniffer & Project Analyzer was built on the premise that technical debt shouldn't be an abstract concept - it should be deeply visible, understandable, and actionable.

This platform bridges the gap between raw codebase complexity and human understanding. By unifying Python parsing, Java static analysis, and Agile process tracking into a single frictionless dashboard, the suite abstracts away the borders between languages and focuses purely on the code.


Architecture Overview

The platform operates on a Zero-Coupling, Event-Reactive Architecture. The frontend strictly delegates analysis to isolated backend engines, which parse raw files into Abstract Syntax Trees (ASTs) on the fly.

graph TD
    classDef frontend fill:#1e3a8a,stroke:#3b82f6,stroke-width:2px,color:#fff;
    classDef controller fill:#475569,stroke:#94a3b8,stroke-width:2px,color:#fff;
    classDef engine fill:#0f172a,stroke:#10b981,stroke-width:2px,color:#fff;
    
    UI[ Streamlit Frontend]:::frontend -->|Unified File Upload| Controller[ Universal Control Center]:::controller
    
    Controller -->|Routes .py| PythonEngine[ Python AST Engine]:::engine
    Controller -->|Routes .java| JavaEngine[ Java AST Engine]:::engine
    Controller -->|Routes .json| AgileEngine[ Agile Process Engine]:::engine
    
    subgraph Core Analyzers
        PythonEngine --> PyMetrics[Complexity & Code Metrics]
        JavaEngine --> JavaSmells[Design & Implementation Smells]
        AgileEngine --> SprintMetrics[Velocity & Scope Creep]
    end
    
    PyMetrics --> Aggregator[ Results Aggregator]
    JavaSmells --> Aggregator
    SprintMetrics --> Aggregator
    
    Aggregator -->|Pandas DataFrames| UI

Request Lifecycle & Data Flow

Data flows deterministically from the browser, through the AST generators, into Pandas dataframes, and back out to Plotly visuals. The UI remains fully stateless until explicitly commanded to execute an analysis.

sequenceDiagram
    participant User as Developer
    participant UI as  UI (app.py)
    participant Engine as  Analyzer Engine
    participant State as  Session State
    
    User->>UI: Uploads Source Code (.py, .java)
    UI->>UI: Auto-categorize by extension
    User->>UI: Adjusts Global Parameters
    User->>UI: Executes CoDiver Analysis
    
    UI->>Engine: Dispatches raw UTF-8 strings & configs
    
    rect rgb(30, 41, 59)
        Note right of Engine: Backend Processing Phase
        Engine->>Engine: Generate Abstract Syntax Trees
        Engine->>Engine: Traverse classes, fields, methods
        Engine->>Engine: Evaluate Code Smells & Constraints
    end
    
    Engine-->>State: Yield structured dictionaries
    State->>State: Transform to Pandas DataFrames
    State-->>UI: Triggers reactive re-render
    
    UI-->>User: Displays interactive visualizations

Internal Module Structure

The repository enforces a strict separation between UI logic and calculation algorithms to guarantee high cohesion and maintainability at scale.

Click to expand the Project Tree
CoDiver/
├── app.py                      # Master Unified Controller & UI Entry Point
├── requirements.txt            # Dependency configuration
└── src/
    ├── java_analyzer/          # Java Static Analysis Subsystem
    │   ├── analyzer_engine.py  # javalang AST traversal logic
    │   ├── dashboard.py        # Session state & execution handlers
    │   ├── detectors/          # Code Smell logic (Design, Naming, etc.)
    │   └── utils/              # UI components & helpers
    │
    └── software_metrics/       # Python & Agile Analytics Subsystem
        ├── calculators/        # Core calculation algorithms (COCOMO, Agile)
        ├── ui/                 # Visualization components (Charts, Cards)
        └── tests/              # Subsystem validation

System Capabilities

Subsystem Core Responsibilities Underlying Tech
Code Metrics AST generation, Cyclomatic & Cognitive complexity mapping, Defect density prediction, COCOMO estimation. ast, radon
Static Architecture God Class detection, Feature Envy identification, naming conventions, Javadoc validation, raw LOC distributions. javalang
Agile Process Velocity tracking, sprint burndown visualization, scope creep calculation. pandas, plotly
Universal Control Unified drag-and-drop ingestion, cross-language processing dispatch, dynamic parameter routing. streamlit

Build & Deployment Pipeline

Because this application leverages a robust Python backend for intensive AST processing, it is deployed natively via containerized Python runtimes (and cannot be served statically via standard GitHub Pages).

Live Demo

The platform is currently live and operational on Streamlit Community Cloud.

Access the live suite here: codiver.streamlit.app

Self-Hosting & Deployment

Because this application leverages a robust Python backend for intensive AST processing, it is deployed natively via containerized Python runtimes.

  1. Fork this repository.
  2. Navigate to Streamlit Share.
  3. Connect your fork and point the main file path to app.py.
  4. The cloud environment will automatically parse requirements.txt and deploy your instance.

Local Development Workflow

To initialize the suite in a local development environment:

# 1. Clone the repository
git clone https://github.com/yourusername/CoDiver.git
cd CoDiver

# 2. Install AST parsers and UI dependencies
pip install -r requirements.txt

# 3. Boot the reactive frontend server
streamlit run app.py

Development & Contribution

New ideas, architectural optimizations, and structural improvements are warmly welcomed. The system is designed to be highly extensible - adding support for a new language parser simply requires introducing a new module within src/ and wiring it to the Universal Control Center in app.py.

When modifying the codebase, please ensure that UI concerns remain strictly separated from backend AST calculation logic.


Engineering Credits

Ahmad Hassan (B-Ted)
Software Engineer

This architecture was designed and engineered from the ground up to solve complex software quality tracking constraints using modern, event-driven Python web paradigms.

License

This repository is published under the MIT License, promoting open knowledge and collaborative engineering.

CoDiver (AhmadHassan-BTed/CoDiver)

正在搜索数据库…

4.7K ·GitHub
这是什么?CoDiver(原名 SMC-Software-Metrics-Calculator)是一个统一的平台,用于代码质量、架构度量和敏捷分析。它将 Python AST 解析、Java 静态分析和冲刺跟踪整合到一个 Streamlit 仪表盘中。
这是命令行工具还是网页仪表盘?它是一个 Streamlit 网页仪表盘,而不是命令行工具。你只需把项目文件拖放到浏览器中,它就会为你运行分析。
怎样才能让它运行起来?Fork 本仓库,进入 Streamlit Share,连接你的 fork,并将主文件路径指向 app.py;云端环境会自动安装依赖。你也可以在本地运行,方便开发。
我需要自己安装 Python 包吗?如果部署到 Streamlit Community Cloud,它会自动从 requirements.txt 安装所有内容;如果是本地开发,则需要自己配置 Python 环境,因为后端依赖 ast、radon、javalang、pandas 和 plotly。
我能把它当作静态页面托管吗?不能。它需要在 Python 中实时进行 AST 解析和分析,因此必须有一个正在运行的后端,无法作为静态站点部署在 GitHub Pages 上。
Java 静态分析实际检查什么?它使用 javalang 解析 Java 代码,标记 God Class、Feature Envy 等代码异味,检查命名规范和 Javadoc 覆盖率,并报告原始代码行数的分布情况。
除了代码质量,我还能跟踪哪些敏捷指标?该平台可以跟踪冲刺速度、燃尽图可视化和范围蔓延,还可以使用 COCOMO 模型估算开发工作量。
有没有无需部署就能试用的在线演示?有。在 Streamlit Community Cloud 上运行着一个在线实例:codiver.streamlit.app。
大小
0.4 MB
星标
4.7K
更新
提交Jun 30
时长
6个月
提交 · 90 天