v1.0.0 — Official Release

Source Code AnalysisPrecision & Speed

Codebase Analyzer delivers a high-performance local source code analysis solution. Driven by a multithreaded C++23 core engine integrated with an elegant, responsive desktop UI.

bash — cba@engine
$./codebase_analyzer--path=[pending]
# Waiting for target directory path...
Scanned directory tree: 0 files
Filter status: Idle
Detected languages: None
Lines of Code (LoC):0
Comments Count:0 (0.0%)
Blank Lines:0
Ready to analyze codebase...
$▌
C++23 Core EngineElectron Native UIReact & TypeScriptTailwind CSS Styling

Objectives & Target Audience

An overview of our mission to build a premium local static code metric tool supporting two primary interactive interfaces.

Project Goal

Build the Codebase Analyzer tool with a robust Object-Oriented design. Supports parallel interfaces: a modern Desktop UI (Electron) and a lightweight, high-performance CLI mode. It performs rapid recursive directory traversal, filters noise, and counts empty lines and comments with microsecond latency.

Target Audience

IT students working on academic assignments, software engineers seeking structural codebase insights before refactoring, or project managers desiring secure, offline, and independent programming productivity metrics.

Directory Traversal
Superfast recursive directory crawling that auto-detects valid source files and cleanly skips unwanted junk folders.
Language Analysis
Identifies target programming languages via extension mapping, dynamically allocating the corresponding polymorphic parser.
Comment Parsing
Accurately extracts single-line and multi-line comments according to language-specific grammar and syntax rules.
Report Generation
Automatically generates beautiful Markdown reports featuring charts, summaries, and file-by-file detail breakdowns.

Interactive Walkthrough

Discover all the features and real-world execution pipeline of the Codebase Analyzer system in our live video demonstration below.

Electron Dashboard

Visualize code metrics interactively through real-time pie charts, bar charts, and scan logs.

C++ Core Engine

Blazing fast local scans with absolute accuracy in filtering out code, empty lines, and comments.

Auto-Export Report

Export comprehensive, structured Markdown reports detailing your project's codebase in one click.

codebase_analyzer_demo.mp4

System Architecture

Structured into two primary layers: the C++ CLI Core for high-performance processing, and the Desktop UI for rendering.

C++ CLI Core

DirectoryScanner — Recursively scans paths, filters noise folders (.git, node_modules...), and honors .gitignore rules.

FileAnalyzer (Abstract) — Base abstract class providing pure virtual interfaces analyze(), languageName(), and language().

Language Analyzers — Specialized Concrete Parsers: CppAnalyzer, CAnalyzer, PythonAnalyzer, JavaAnalyzer, CSharpAnalyzer, JavaScriptAnalyzer, TypeScriptAnalyzer, WebAnalyzer, HtmlAnalyzer, CssAnalyzer.

ReportGenerator — Outputs consolidated statistics to standard console and Markdown reports.

Desktop UI

Electron — Manages backend-native processes, window lifecycles, and direct filesystem access.

React + TypeScript — Powers reactive presentation layers and robust modular layout design.

Vite — Accelerates local frontend builds and features near-instant Hot Module Replacement.

Tailwind CSS — Implements high-fidelity, polished, and futuristic dark-themed responsive styles.

Use Case Diagram

The UML Use Case diagram maps out the primary interactions between developers and the static analyzer.

UML — Use Case Diagram
Use Case Diagram

UML Sequence Diagram

The sequence diagram traces runtime interactions: React UI triggers electron IPC, spawning a C++ CLI subprocess to Scan and run polymorphic analyzer hooks.

Click steps to inspect details:
Step 01👨‍💻 Developer
Select target folder & click 'Analyze'
Step 02🖥️ React UI
Send IPC 'scan-directory' event
Step 03📦 Electron Main
Spawn C++ Core CLI process
Step 04⚙️ C++ Scanner
Load ignore rules & scan
Step 05🧩 FileAnalyzer
file->analyze() (Polymorphic)
Step 06⚙️ C++ Core
Save Markdown & output JSON
Step 07📦 Electron Main
IPC Reply with dataset
Step 08🖥️ React UI
Render charts & Dashboard
⚡ RUNTIME EXPLANATION
Select any step on the left to trace the system flow at runtime.
OOP Core Pattern: Dynamic Binding

Use Cases Detail

IDUse Case NameFunctional Description
UC-01Select Directory & FiltersUsers select their target codebase via the Desktop UI directory picker or pass the path via CLI argument. The engine initializes scanning only on valid directories and applies automatic exclusion rules.
UC-02Recursive Directory ScanCrawls subdirectories recursively to discover supported files, instantiating corresponding polymorphic parser sub-objects.
UC-03Analyze Source ContentReads files line-by-line, runs string trimming to ignore excessive whitespace, and accurately flags blank lines, code, or comments.
UC-04Summarize & ExportAggregates scan results, displays statistics on the console or reactive charts, and automatically saves a codebase_report.md file.

Academic Pros & Cons Analysis

A detailed review highlighting core performance advantages and technical system constraints.

🟢 Key Architectural Strengths

Blazing Local Speed

Processes over 10,000 files in under 0.5s via C++ standard libraries and low-overhead string iterators.

Polymorphic Scalability

Adheres to SOLID Open/Closed principle. Easily support new languages by extending FileAnalyzer without altering scanner routines.

100% Security & Privacy

Performs full scans entirely offline locally, guaranteeing zero data leakage of proprietary code.

Polished Desktop Dashboard

Replaces traditional terminal outputs with intuitive, responsive real-time Electron chart visualization.

🔴 Current Academic Limitations

Compiler Portability

Requires separate native OS build compilation pipelines (Windows, Linux, macOS) for the C++ binary.

Lexical String Scopes

Performs line-by-line lexical heuristic count rather than building full AST. String literals containing multi-line block comments might introduce small offsets.

OOP Principles

Demonstrating clean academic compliance with the four core principles of Object-Oriented Programming.

Abstraction
FileAnalyzer defines the common interface for all analyzers. The methods analyze(), languageName(), and language() are pure virtual.
virtual void analyze() = 0;
Inheritance
Specific concrete analyzers (CppAnalyzer, PythonAnalyzer, ...) inherit from FileAnalyzer, reusing common metrics and extending custom grammars.
class CppAnalyzer : public FileAnalyzer { ... };
Polymorphism
analyze() is invoked dynamically via a base class pointer (std::unique_ptr<FileAnalyzer>), letting runtime dispatch execute the correct parser.
vector<unique_ptr<FileAnalyzer>> files;
Encapsulation
Analysis metrics (codeLines_, commentLines_, blankLines_) are kept protected. Access is strictly controlled via const getters with [[nodiscard]].
[[nodiscard]] std::size_t codeLines() const noexcept;

UML Class Diagram

Detailed class diagram showcasing clean inheritance hierarchies, composition, and polymorphic design.

UML — Class Diagram
UML Class Diagram

Class Architecture Breakdown

View Class Description Table ↓

«abstract» FileAnalyzer
filePath_ : filesystem::path
fileName_ : string
fileSize_ : uintmax_t
codeLines_ : size_t
commentLines_ : size_t
blankLines_ : size_t

analyze() : void «pure virtual»
languageName() : string «pure virtual»
language() : Language «pure virtual»
totalLines() : size_t
filePath() : const path&
fileName() : const string&
codeLines() : size_t [[nodiscard]]
commentLines() : size_t [[nodiscard]]
blankLines() : size_t [[nodiscard]]
isBlank(line) : bool «static»
trim(s) : void «static»
CppAnalyzer
CAnalyzer
PythonAnalyzer
JavaAnalyzer
CSharpAnalyzer
JavaScriptAnalyzer
TypeScriptAnalyzer
WebAnalyzer
HtmlAnalyzer
CssAnalyzer
DirectoryScanner
rootPath_ : filesystem::path
files_ : vector<unique_ptr<FileAnalyzer>>
ignoredDirectories_ : size_t
ignoredFiles_ : size_t
unsupportedFiles_ : size_t
defaultIgnoreRules_ : vector<string>
gitignoreRules_ : vector<string>
appliedIgnoreRules_ : vector<string>

scanDirectory() : void
runAnalysis() : void
getFiles() : const vector&
getRootPath() : const path&
ignoredDirectoriesCount() : size_t
ignoredFilesCount() : size_t
unsupportedFilesCount() : size_t
gitignoreRules() : const vector&
appliedIgnoreRules() : const vector&
loadIgnoreRules() : void
shouldIgnore(path, isDir) : bool
createAnalyzer(path) : unique_ptr
ReportGenerator
scanner_ : const DirectoryScanner&

printConsoleReport() : void
generateMarkdownReport(path) : void

Multi-Language Support

LanguageSupported ExtensionsClass Name
C++.cpp, .hpp, .cxx, .cc, .hxx, .hhCppAnalyzer
C.c, .hCAnalyzer
Python.pyPythonAnalyzer
Java.javaJavaAnalyzer
C#.csCSharpAnalyzer
JavaScript.js, .jsx, .mjs, .cjsJavaScriptAnalyzer
TypeScript.ts, .tsx, .mts, .ctsTypeScriptAnalyzer
HTML.html, .htmHtmlAnalyzer
CSS.cssCssAnalyzer

Analysis Pipeline

The end-to-end data flow executing inside the codebase analyzer from initial path input to generated report output.

Input Path
→
Directory Scanner
→
Filter & Ignore
→
Create Analyzer
→
analyze()
→
Aggregate Stats
→
Report Output
main.cpp — Entry Point
cba::DirectoryScanner scanner(targetDir);
scanner.scanDirectory();    // Recursive Scan
scanner.runAnalysis();     // Run analyze() on each file

cba::ReportGenerator reportGen(scanner);
reportGen.printConsoleReport();
reportGen.generateMarkdownReport("codebase_report.md");

Automated Unit Testing

A lightweight, robust, and platform-independent unit testing suite implemented in C++ to guarantee core scanner accuracy. Runs out-of-the-box on Windows, macOS, and Linux.

Unit Test Console Output (Cross-Platform ASCII)
PowerShell - ctest --output-on-failure
PS D:\Codebase-Analyzer> cmake --build build --config Debug
[100%] Built target unit_tests

PS D:\Codebase-Analyzer> cd build ; ctest --output-on-failure
Test project D:/Codebase-Analyzer/build
    Start 1: CoreUnitTests
1/1 Test #1: CoreUnitTests ....................   Passed    0.02 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.03 sec

PS D:\Codebase-Analyzer> .\Debug\unit_tests.exe
=== RUNNING CODEBASE ANALYZER UNIT TESTS ===
[OK] [Unit Test] String trimming logic passed!
[OK] [Unit Test] Blank line detection passed!
[OK] [Unit Test] Metrics encapsulation passed!
[SUCCESS] ALL UNIT TESTS PASSED SUCCESSFULLY!
C++ Unit Test Implementation
tests/unit_tests.cpp
#include <cassert>
#include <iostream>
#include "FileAnalyzer.hpp"

// Custom Test Analyzer class to test protected methods
class TestFileAnalyzer : public cba::FileAnalyzer {
public:
    using FileAnalyzer::trim;
    using FileAnalyzer::isBlank;
    // ...
};

void testStringTrimming() {
    std::string spaces = "  code  ";
    TestFileAnalyzer::trim(spaces);
    assert(spaces == "code");
    std::cout << "[OK] [Unit Test] String trimming logic passed!\n";
}

int main() {
    try {
        testStringTrimming();
        // ... other test suites
        std::cout << "[SUCCESS] ALL UNIT TESTS PASSED SUCCESSFULLY!\n";
        return 0;
    } catch (...) {
        return 1;
    }
}

Technologies

The perfect synergy of raw C++ performance with modern, fluid, responsive web-tech desktop interfaces. Architected natively for all 3 major OS platforms (Windows, macOS, Linux) and virtualized environments (VMs, WSL2, Hyper-V).

C++23 Standard
Taps into ultra-modern APIs like std::filesystem, std::unique_ptr, and highly optimized standard C++ containers.
CMake 3.20+
Cross-platform compilation system automating tests, binary packaging, and custom build pipelines.
Electron Shell
High-performance native shell wrapper managing backend IPC communication with the compiled C++ core.
React + TS
Powers highly modular reactive UI components with 100% complete compile-time type safety.
Vite Bundler
Hyperfast frontend development bundler providing near-instantaneous Hot Module Replacement.
GitHub Workflows
Continuous Integration & Deployment pipeline automatically building installers for Windows, macOS, and Linux.

Core Standard Libraries

Standard C++ library features heavily exploited to build the high-speed static codebase analysis engine.

<filesystem>
Enables secure, system-native recursive path traversal and high-performance file status querying.
<memory>
Eliminates memory leak hazards through exclusive smart pointer memory resource ownership.
<string> & <algorithm>
High-speed string manipulation utilizing iterators and space-trimming filters.

Download & Setup

Download our desktop installer or compile the CLI engine from source code on any major operating system.

Desktop App — Windows
Provides a portable package available in both standard Intel/AMD (x64) and native ARM64 (perfect for ARM-based Windows virtual machines) architectures.
CLI Mode (Build from Source)
Requirements: MSVC (Visual Studio) or MinGW, and CMake.
Developer Terminal
git clone https://github.com/ThanhNguyn/Codebase-Analyzer.git
cd Codebase-Analyzer
cmake -S . -B build
cmake --build build --config Release
.\build\Release\codebase_analyzer.exe .\your-project
🛠️

System Operations & Setup Guide

1. Architecture Selection

• Standard PC / x64 VM: Download codebase-analyzer-win-x64.exe
• Snapdragon Laptops / ARM64 VM: Download codebase-analyzer-win-arm64.exe

2. Troubleshooting Warnings

• Portable App: No installation required, just double-click to run directly.
• SmartScreen Blocker: Windows Defender might block it ("Windows protected your PC"). Click 'More info' and then select 'Run anyway'.
💻

General Specs

  • ✔100% OFFLINE operation ensuring absolute security for local code metrics traversal.
  • ✔Rich polymorphically-supported languages: C/C++, Python, Java, C#, JS, TS, HTML, CSS.
  • ✔Intelligent ignore engine: Automatically skips node_modules, .git, and obeys local .gitignore rules.

References & Technology Stack

Standard academic documentations and fundamental open-source libraries inherited for project development.

C++ Standard & Tools

Frontend UI Technologies

404 Team Not Found

Object-Oriented Programming (OOP) Semester Project

Leader

Nguyễn Tuấn Thành

25112107

Member

Đoàn Ngọc Bích

25112138

Member

Nguyễn Đăng Khoa

25112163