Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Static Analysis & Code Quality
  3. escomplex

escomplex

MITJavaScript1.3.0

A JavaScript complexity analysis library that calculates maintainability, cyclomatic complexity, and Halstead metrics from ASTs.

GitHubGitHub
274 stars26 forks0 contributors

What is escomplex?

escomplex is a JavaScript complexity analysis library that processes abstract syntax trees to calculate software metrics. It helps developers understand code quality by providing maintainability indexes, cyclomatic complexity, Halstead metrics, and dependency analysis. The tool identifies complex code areas that might be difficult to maintain or test.

Target Audience

JavaScript developers and teams who need to monitor code quality, technical debt, and maintainability in their projects. It's particularly useful for code reviewers, architects, and developers working on large codebases.

Value Proposition

escomplex provides comprehensive, configurable complexity metrics directly from ASTs with detailed per-function and project-wide analysis. Unlike simpler tools, it offers dependency analysis between modules and customizable calculation options for different coding styles.

Overview

Software complexity analysis of JavaScript-family abstract syntax trees.

Use Cases

Best For

  • Measuring code maintainability in JavaScript projects
  • Identifying complex functions that need refactoring
  • Tracking technical debt and code quality over time
  • Analyzing dependencies between modules in a project
  • Integrating complexity analysis into build pipelines
  • Comparing complexity metrics across different codebases

Not Ideal For

  • Teams needing immediate, visual code quality reports without additional tooling
  • Projects requiring real-time complexity analysis during development (e.g., IDE plugins)
  • Codebases primarily using ES6+ modules without CommonJS/AMD dependencies
  • Small scripts or one-off analyses where detailed metrics are overkill

Pros & Cons

Pros

Comprehensive Metric Suite

Provides a wide range of metrics including maintainability index, cyclomatic complexity, and Halstead measures, offering a holistic view of code quality. Evidence from README: Detailed result formats cover sloc, params, cyclomatic density, and Halstead effort, bugs, and time.

Configurable Analysis Options

Allows customization of complexity calculations for logical OR, switch cases, for-in loops, and try-catch blocks via options. README shows options like logicalor and switchcase to tailor analysis to coding styles.

Multi-module Dependency Analysis

Analyzes dependencies between modules and computes project-wide metrics like adjacency and visibility matrices. README specifies that for multiple modules, it returns first-order density, change cost, and core size.

Detailed Function-Level Reports

Delivers granular metrics per function, including line numbers and parameter counts, aiding in pinpointing complex code. Evidence: Functions array in results includes sloc, cyclomatic, and Halstead data for each function.

Cons

Performance Overhead in Large Projects

Calculations like visibility matrix and core size can be expensive; README admits this with options like noCoreSize to skip them, indicating scalability issues for big codebases.

AST Dependency Limits Flexibility

Tied to JavaScript ASTs, so it doesn't natively support other languages or syntaxes without extra parsers, and README doesn't mention TypeScript or modern ES modules explicitly.

No Built-in Visualization

Acts as a back-end library only, requiring integration with tools like complexity-report for user-friendly reports, which adds setup complexity compared to all-in-one solutions.

Frequently Asked Questions

Quick Stats

Stars274
Forks26
Contributors0
Open Issues9
Last commit2 years ago
CreatedSince 2014

Tags

#ast-analysis#cyclomatic-complexity#software-metrics#maintainability#code-quality#javascript#complexity-metrics#code-analysis#static-analysis

Built With

N
Node.js

Included in

Static Analysis & Code Quality14.5k
Auto-fetched 9 hours ago

Related Projects

PHP ParserPHP Parser

A PHP parser written in PHP

Stars17,465
Forks1,134
Last commit2 days ago
TypeScript ESLintTypeScript ESLint

:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript

Stars16,390
Forks3,002
Last commit12 hours ago
pyrightpyright

Static Type Checker for Python

Stars15,625
Forks1,809
Last commit4 days ago
ReviewdogReviewdog

🐶 Automated code review tool integrated with any code analysis tools regardless of programming language

Stars9,568
Forks492
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub