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.
Objectives & Target Audience
An overview of our mission to build a premium local static code metric tool supporting two primary interactive interfaces.
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.
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.
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.
System Architecture
Structured into two primary layers: the C++ CLI Core for high-performance processing, and the Desktop UI for rendering.
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.
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 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.
Use Cases Detail
| ID | Use Case Name | Functional Description |
|---|---|---|
| UC-01 | Select Directory & Filters | Users 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-02 | Recursive Directory Scan | Crawls subdirectories recursively to discover supported files, instantiating corresponding polymorphic parser sub-objects. |
| UC-03 | Analyze Source Content | Reads files line-by-line, runs string trimming to ignore excessive whitespace, and accurately flags blank lines, code, or comments. |
| UC-04 | Summarize & Export | Aggregates 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.
UML Class Diagram
Detailed class diagram showcasing clean inheritance hierarchies, composition, and polymorphic design.

Class Architecture Breakdown
View Class Description Table ↓
Multi-Language Support
| Language | Supported Extensions | Class Name |
|---|---|---|
| C++ | .cpp, .hpp, .cxx, .cc, .hxx, .hh | CppAnalyzer |
| C | .c, .h | CAnalyzer |
| Python | .py | PythonAnalyzer |
| Java | .java | JavaAnalyzer |
| C# | .cs | CSharpAnalyzer |
| JavaScript | .js, .jsx, .mjs, .cjs | JavaScriptAnalyzer |
| TypeScript | .ts, .tsx, .mts, .cts | TypeScriptAnalyzer |
| HTML | .html, .htm | HtmlAnalyzer |
| CSS | .css | CssAnalyzer |
Analysis Pipeline
The end-to-end data flow executing inside the codebase analyzer from initial path input to generated report output.
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.
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!#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).
Core Standard Libraries
Standard C++ library features heavily exploited to build the high-speed static codebase analysis engine.
Download & Setup
Download our desktop installer or compile the CLI engine from source code on any major operating system.
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-projectSystem 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
- ISO C++23 Filesystem Library ↗
Standardized cross-platform API for filesystem traversal and file status querying.
- CMake Build System (v3.20+) ↗
Cross-platform automation build system configuring the C++ core engine.
Frontend UI Technologies
- Electron Shell Framework ↗
High-performance native desktop shell managing IPC with compiled C++ core.
- React 19 & Next.js 15 ↗
Modern component architecture powering highly modular reactive UI.
- Framer Motion ↗
Production-ready motion library for fluid web animations and interactions.
404 Team Not Found
Object-Oriented Programming (OOP) Semester Project
Nguyễn Tuấn Thành
25112107
Đoàn Ngọc Bích
25112138
Nguyễn Đăng Khoa
25112163