Skip to content

Latest commit

Β 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”΄ DPX-Erlang: Software Architecture & OTP Design Pattern Scanner

CI License: MIT Erlang/OTP Architecture: Hexagonal DDD

DPX-Erlang is an enterprise-grade, high-performance static analysis and software design pattern detection engine for Erlang / OTP (OTP 20 - 27+).

Built with a clean Hexagonal (Ports & Adapters) Domain-Driven Design (DDD) architecture, DPX-Erlang uses a Bayesian evidence trail to accurately detect OTP behaviours, actor concurrency patterns, supervisor hierarchy trees, Let-It-Crash resilience violations, and code smells across Erlang applications and releases.


πŸš€ Key Features

  • 30 Erlang & OTP Architecture Rules:
    • OTP Behaviours (6): gen_server, supervisor, gen_statem / gen_fsm, gen_event, application, special_process (proc_lib / sys).
    • Actor Concurrency (5): Native Actor Model loop (receive ... end), Publish/Subscribe process groups (pg / pg2), Worker Pools (poolboy), Circuit Breakers (fuse), Process Lifecycle Observers (monitor / link).
    • Structural Patterns (6): Adapter, Decorator / Interceptor, Facade API modules, Process Proxies, ETS / persistent_term Flyweights, Composite Supervision Trees.
    • Behavioral Patterns (6): Tagged Tuple Command Dispatch, Dynamic Strategy Callback Dispatch (Mod:Func(...)), Template Method (-callback), Memento State Snapshots (dets / mnesia), Middleware Pipelines, Functional Data Transformations (lists:foldl).
    • Resilience, SOLID & Safety (10): Let-It-Crash Violations (catch _:_ -> ignore), Selective Receive Mailbox Leaks, Blocked Actor handle_call I/O, Supervisor Restart Storms, God Modules (SRP), Behaviour Callback Compliance, Circular Module Cycles, KISS, DRY, Dynamic Atom Exhaustion (list_to_atom).
  • High-Throughput Streaming AST Parser:
    • Analyzes ~1,000 Erlang files per second without relying on external compiler dependencies or Beam VM execution.
  • Interactive Semantic UI HTML Dashboard:
    • Dark Semantic UI (Fomantic-UI) dashboard with instant filtering, zero-violation alerts, and "Copy Architecture Map for LLM" prompt generator for AI coding assistants.
  • OASIS SARIF v2.1.0 & CI/CD Support:
    • Native output format for GitHub Code Scanning, GitLab SAST, SonarQube, JSON, and Markdown.

πŸ“¦ Quickstart & Installation

# Clone the repository
git clone https://github.com/bivex/DPX-Erlang.git
cd DPX-Erlang

# Install with uv
uv sync

πŸ’» CLI Usage

# Scan current Erlang project
uv run dpx scan .

# Scan specific Erlang app and generate all reports
uv run dpx scan /path/to/erlang_app \
    --html-output reports/dashboard.html \
    --sarif-output reports/security.sarif \
    --markdown-output reports/analysis.md \
    --json-output reports/data.json

# Filter by pattern
uv run dpx scan . -p gen_server -p supervisor

# Output LLM context map directly for AI agents
uv run dpx scan . --llm

πŸ“Š Real-World Benchmarks

Project Category Files Findings Time Speed Status
ninenines/cowboy HTTP / Websocket Server 189 484 0.206s 917 f/s βœ… 0 crashes
erlang/rebar3 Erlang Build Tool 297 973 0.363s 818 f/s βœ… 0 crashes
mochi/mochiweb Lightweight Web Server 59 180 1.641s - βœ… 0 crashes
ninenines/ranch Socket Acceptor Pool 47 135 0.038s 1,236 f/s βœ… 0 crashes
erlang-lager/lager Logging Framework 43 164 0.048s 895 f/s βœ… 0 crashes
eproxus/meck Mocking Library 24 138 0.022s 1,090 f/s βœ… 0 crashes
talentdeficit/jsx Streaming JSON Engine 11 67 0.047s 234 f/s βœ… 0 crashes
devinus/poolboy Worker Pool Management 7 25 0.006s 1,166 f/s βœ… 0 crashes
TOTAL 8 Repositories 677 files 2,166 detections 2.370s 285 f/s πŸš€ 100% stable


🌐 The DPX Multi-Language Static Analysis Family (33 Languages)

# Language Repository Ecosystem & Focus
1 Ada bivex/DPX-Ada Ada 2012/2022, SPARK Contracts, Ravenscar Tasking, DO-178C Safety
2 Clojure bivex/DPX Lisp S-Expressions, Protocols, Multimethods
3 C bivex/DPX-C Memory Safety, Struct VTables, Idiomatic C11/C23
4 Cairo bivex/DPX-Cairo Starknet Smart Contracts, ZK-Rollup Invariants
5 C++ bivex/DPX-Cpp RAII, CRTP, Concepts, Modern C++20/23
6 C# bivex/DPX-CSharp .NET 9, Roslyn AST, Linq, Records
7 Dart bivex/DPX-Dart Dart 3.x, Flutter, BLoC, Riverpod, Isolates
8 Elixir bivex/DPX-Elixir BEAM OTP, GenServer, Supervisors
9 Erlang bivex/DPX-Erlang Fault Tolerance, Actor Model, OTP Behaviors
10 Gleam bivex/DPX-Gleam Type-Safe BEAM, Actor Concurrency
11 Go bivex/DPX-Go Goroutines, Channels, Composition, Interfaces
12 Haskell bivex/DPX-Haskell Pure Functional, Monads, Typeclasses, Arrows
13 Huff bivex/DPX-Huff Low-Level EVM Bytecode & Opcodes
14 Idris 2 bivex/DPX-Idris2 Dependent Types, QTT Linear Protocols, Totality, Proofs
15 Java bivex/DPX-Java Spring Boot, Enterprise Java, JVM Invariants
16 Julia bivex/DPX-Julia Multiple Dispatch, Scientific Computing
17 Kotlin bivex/DPX-Kotlin Coroutines, Multiplatform, Functional DSLs
18 Lua bivex/DPX-Lua Metatables, Coroutines, LuaJIT, Neovim
19 Mojo bivex/DPX-Mojo SIMD Hardware, Memory Lifetimes, AI Systems
20 Move bivex/DPX-Move Aptos & Sui Resource Safety, Linear Types
21 OCaml bivex/DPX-OCaml Algebraic Data Types, Functors, Polymorphism
22 PHP bivex/DPX-Php Modern PHP 8.4, Attributes, Traits, Laravel
23 Prolog bivex/DPX-Prolog ISO Prolog, SWI-Prolog, DCG, CLP(FD/R/Q), CHR, Meta-Interpreters
24 Puppet bivex/DPX-Puppet Puppet DSL, Roles/Profiles, IaC Security, Hiera
25 Python bivex/DPX-Py Metaprogramming, Protocols, Hexagonal DDD
26 Ruby bivex/DPX-Ruby Ruby 3.x, Rails, Metaprogramming, Dry-RB, Security
27 Rust bivex/DPX-Rust Zero-Cost Abstractions, Borrow Checker, Traits
28 Solidity bivex/DPX-Solidity DeFi Security, Reentrancy, EVM Yul/Assembly
29 SQL bivex/DPX-SQL PostgreSQL, MySQL, SQLite, T-SQL, PL/SQL
30 Swift bivex/DPX-Swift Protocol-Oriented Programming, Actors
31 TypeScript bivex/DPX-TypeScript Generics, Conditional Types, Clean Architecture
32 Yul bivex/DPX-Yul EVM Intermediate Representation Optimization
33 Zig bivex/DPX-Zig Comptime, Manual Memory Allocators, C ABI

πŸ“„ License

Distributed under the MIT License. See LICENSE for details.

About

πŸ”΄ Hexagonal Architecture & OTP Design Pattern Scanner for Erlang / OTP (OTP 20 - 27+)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages