Feature Documentation & Calculation Mechanics
Archon
One Engineering Reference & Analysis Manual
This comprehensive guide documents all 18 core static analysis modules, metric algorithms,
security checkers, mathematical formulas, and architectural intelligence rules implemented
inside Archon One. Scroll down to review each analysis section in full detail.
01.
Cyclomatic Complexity & Cognitive Complexity
Cyclomatic Complexity (CC) measures the quantitative count of linearly
independent control-flow paths through a program's source code. It represents the structural
branching complexity and determines the minimum number of unit test cases required to
achieve 100% decision branch coverage.
Cognitive Complexity (COG) assesses how difficult code is for human
developers to comprehend and maintain. Unlike Cyclomatic Complexity, Cognitive Complexity
does not increment for simple multi-condition structures, but heavily penalizes nested
control structures, recursion, and breaks in linear reading flow.
Cyclomatic Complexity (CC) = E - N + 2P = 1 + Total_Decision_Points
Cognitive Complexity (COG) = ∑ ( Nesting_Level_Weight + Decision_Increment )
Calculation Steps in Archon
One:
- Base Value: Starts at
CC = 1 for every analyzed file and
function scope.
- Decision Point Increments (+1 CC): Evaluates AST nodes and regex
pattern rules for decision keywords:
if, elif,
else if, for, while, do,
catch, case, ternary ?, and logical operators
(&&, ||, and, or).
- Cognitive Nesting Weight: Increments Cognitive Complexity by
1 for each control flow statement, plus an additional +1 for
each level of enclosing nesting depth (e.g., an if statement inside 2
nested loops receives a cognitive weight of 1 + 2 = 3).
| CC Score Range |
Risk Classification |
Maintainability Impact |
Recommended Engineering Action |
| 1 - 10 |
Low Risk |
Simple, clean, highly testable code |
None required (Ideal state) |
| 11 - 20 |
Moderate Risk |
Moderate complexity, requires test coverage |
Monitor complex methods |
| 21 - 50 |
High Risk |
Complex code, high defect probability |
Refactor into smaller helper functions |
| 50+ |
Critical Risk |
Untestable, fragile "God Method" |
Urgent modular refactoring mandatory |
02.
Maintainability Index (MI) & Technical Debt Score
The Maintainability Index (MI) is an SEI (Software Engineering Institute)
standard composite metric that quantifies the relative maintainability of source code files
on a 0 to 100 scale.
Technical Debt Score estimates the accumulated remediation work required to
resolve code smells, architectural flaws, and security findings across the codebase.
MI = MAX(0, (171 - 5.2 * ln(Halstead_Volume) - 0.23 * Cyclomatic_Complexity - 16.2 *
ln(Logical_LOC) + 50 * sin(sqrt(2.4 * Comment_Density_Pct))) * 100 / 171)
Technical Debt Score = 100 - MI + (Code_Smells * 2.5) + (Security_Findings * 5.0)
Maintainability Grading
System:
- Grade A (MI ≥ 80): Highly maintainable, excellent modular structure,
minimal debt.
- Grade B (65 ≤ MI < 80): Good maintainability, minor refactoring
recommended.
- Grade C (50 ≤ MI < 65): Moderate maintainability, moderate code smells
present.
- Grade D (20 ≤ MI < 50): Low maintainability, elevated bug risk during
modifications.
- Grade F (MI < 20): Critical technical debt, requires comprehensive
architecture overhaul.
03. Fast
Scan Mode & Incremental Hashing Engine
Archon One implements a high-performance file signature fingerprinting engine designed for
sub-second incremental scans on large repositories.
File_Signature = MD5( Relative_Path + ":" + File_Size_Bytes + ":" + Last_Modified_Timestamp
)
Execution Modes:
- Fast Scan Mode: Utilizes multi-threaded regex line parsing to skip
heavy full AST parsing for unchanged non-critical files, reducing scan times by up to
90%.
- Incremental Scan Mode: Checks file signatures against
.archon_cache.json. If the fingerprint matches, cached metrics and security
results are re-used instantly.
04.
Untested Files & Coverage Gap Analysis
Cross-references source implementation files against test files across Python, Java, Go,
Rust, TypeScript, C++, Kotlin, and PHP.
Coverage_Gap_Percentage = ( Untested_Source_Files / Total_Source_Files ) * 100
Pattern Matching Rules:
- Test Folders:
/tests/, /__tests__/,
/test/.
- Test Files:
test_*.py, *_test.go,
*.test.js, *.spec.ts, Test*.java,
*.test.rs.
- Risk Scoring: Assigns High Risk to untested files located inside
core/, security/, auth/, or engine/
modules.
05.
Naming Conventions & Code Style Enforcement
Parses AST declaration nodes to verify symbol compliance against language standards.
- Class Declarations: Validates
PascalCase (e.g.,
UserManager). Snake-case class names like user_manager are
flagged as Medium severity violations.
- Function & Method Declarations: Validates
snake_case for
Python/Rust and camelCase for JavaScript/Java/Go.
- Constants: Global variables in uppercase must match
UPPER_CASE (e.g., MAX_RETRY_COUNT).
06.
Recursive Calls & Call Depth Risk
Analyzes function body call-graphs for self-invocations ($f(x) \to f(x-1)$) and mutual
recursive loops ($A \to B \to A$), evaluating base case guard statements to prevent call
stack overflow crashes.
07.
Memory Heavy & Resource Allocation Auditor
Detects unclosed file descriptors (e.g., open() calls lacking with
context managers), malloc() allocations without free(), and
unclosed database connection pools.
08. SQL
Injection & Dynamic Query Auditor
Identifies raw string formatting (`f"SELECT ... {var}"`, `%s`, `+ input`, `${id}`) inside
database query execution contexts (`cursor.execute`, `db.query`), flagging High severity SQL
injection risks.
09.
Network & Infrastructure Security Smells
Scans configuration files and socket binds for global exposure (`0.0.0.0`), unencrypted HTTP
endpoints, and disabled SSL/TLS certificate verification (`verify=False`,
`InsecureSkipVerify: true`).
10. API
Contract & Endpoint Security Risks
Inspects web API route definitions for CORS wildcard headers (`Access-Control-Allow-Origin:
*`), missing authentication decorators, and exposed internal debug endpoints.
11.
Error Handling & Exception Swallowing Smells
Identifies bare `except: pass`, empty `catch (e) {}` blocks, ignored error return values in
Go, and unhandled promise rejections.
12.
Concurrency & Thread Safety Analyzer
Detects thread lock acquisitions missing `finally` or context manager releases, blocking
synchronous I/O inside `async def` routines, and raw global state mutations.
13.
Structural & Object-Oriented Smell Analyzer
Flags God Methods (> 100 LOC), Large Classes (> 500 LOC), Deep Inheritance Trees (depth >
3), and Long Parameter Lists (> 5 parameters).
14.
Secret Vault (AES-256-GCM Protection)
Uses `scrypt(N=32768, r=8, p=1)` to derive a 256-bit encryption key from a master password.
Encrypts sensitive workspace files with AES-256-GCM generating 12-byte IVs and 16-byte
authentication tags.
15.
Interactive Knowledge Graph Canvas
Constructs a multi-tiered graph schema with nodes (Repository, Folder, File, Class,
Function, API, DB, Package) and directed edges (`CONTAINS`, `IMPORTS`, `CALLS`, `EXTENDS`,
`EXPOSES`).
16.
Dynamic Architecture Diagram Generators
Parses codebase AST, imports, class hierarchies, and database calls to dynamically generate
14 Mermaid (`.mmd`) and PlantUML (`.puml`) architecture diagrams.
17.
Dependency Graph & Circular Reference Finder
Builds an adjacency matrix $G=(V,E)$ of module imports and runs Tarjan's Strongly Connected
Components (SCC) algorithm to detect circular import chains ($A \to B \to C \to A$).
18. Code
Duplication & Token Hashing Algorithm
Tokenizes source code, strips comments and whitespace, and applies a sliding window MD5 hash
across line sequences ($W \ge 5$) to detect duplicate code blocks across files.
Complexity & Code Thresholds
Security & Vulnerability Thresholds
Secret Vault (AES-256-GCM Protection)
Checking...
Encrypt sensitive workspace files (such as
.env, credentials.json, *.pem) using
AES-256-GCM with scrypt key derivation.
Empirical Reports & Scan History
Repository Scan Reports History
Manage past repository scans and launch full unified
interactive HTML reports in a new tab.
Interactive Knowledge Graph Canvas
Loading Knowledge Graph...
Connecting to
Knowledge Graph API...
0%
Entity
Legend:
● Repository
● Folder
● File
● Class
● Function
● API Endpoint
● Package
● Database
Architecture Diagrams Customization
About Archon One Settings
v0.5.0
Project Root / archon-config.json
Secret Vault (AES-256-GCM File Protection)
Vault Status
Checking...
Encrypt sensitive workspace files (such as
.env, credentials.json, *.pem) using
AES-256-GCM with scrypt key derivation.
CLI Commands & Options Guide
Core Scanning & Intelligence Commands
Archon One
features 3 primary intelligence command modules with unified flags:
archon
scan [path]
Full
Scan
Scans
codebase for Code Metrics, Security Audit, Code Analysis, Contributor Analysis, &
Repository Intelligence (excluding Knowledge Graph).
archon scan
# Scan current directory
archon scan -s ./src
# Specify source path
archon scan -o ./reports
# Custom output path
archon scan -g https://github.com/... # Clone & scan remote GitHub repo
archon
graph [path]
Knowledge
Graph
Generates
the 12-file self-contained Knowledge Graph JSON schema, textual summary, and
markdown repository map.
archon graph
# Generate graph for current directory
archon graph -s ./src -o ./out_graph # Custom source & output paths
archon graph -g https://github.com/... # Generate graph from remote GitHub repo
archon
diagrams [path]
Diagrams
Generates
14 codebase architecture diagrams in Mermaid, SVG, and PNG formats.
archon diagrams
# Generate diagrams for current directory
archon diagrams -s ./src -o ./out_diag # Custom source & output paths
archon diagrams -g https://github.com/...# Remote repo diagrams
Command Profiles (CLI & Web Dashboard)
Create,
list, edit, delete, and execute custom command shortcuts directly from CLI or Web Dashboard:
archon profiles list
# List all saved command profiles
archon profiles add <name> "cmd1" "cmd2"
# Create a new profile (e.g. archon profiles add backend
"archon scan" "archon graph")
archon profiles edit <name> "cmd1" "cmd2"
#
Update commands sequence for an existing profile
archon profiles delete <name>
# Delete a command profile
archon <profile_name>
# Run profile command sequence in order
Secret Vault File Protection
Protect
sensitive environment & credential files using AES-256-GCM authenticated encryption:
archon vault status
# Check protection status & list of protected files
archon vault mask <file_path>
# Encrypt & mask sensitive file (e.g. .env)
archon vault unmask <file_path>
# Decrypt & restore file using master password
archon vault change-password
# Re-encrypt vault with new master password
Report Compilation & Utilities
archon report [scan_dir]
# Compile scan directory into single index.html
report
archon config [--port 8085]
# Launch offline Web Settings & Intelligence
Dashboard
archon reset
# Reset configuration to factory defaults
archon help
# Display CLI runner guide
archon about
# Show developer & version details