Skip to main content

A Python tool for analyzing C code complexity using Halstead and Cyclomatic metrics.

Project description

🧮 Halstead++

Halstead++ is a lightweight static analysis tool for C source code, built in Python.
It leverages Abstract Syntax Tree (AST) parsing to compute both Halstead complexity metrics and Cyclomatic complexity, providing structured insights into code readability, logical structure, and cognitive effort.

This tool offers a clear, visually rich output directly in the terminal — ideal for developers, educators, and researchers studying code complexity or program structure.


✨ Key Features

  • 📊 Halstead Metrics

    • Distinct operators (n₁), distinct operands (n₂)
    • Total operators (N₁), total operands (N₂)
    • Vocabulary, Length, Volume, Difficulty, Effort, Time, Estimated Bugs
  • 🔁 Cyclomatic Complexity (McCabe) per function

  • 🌳 AST-based analysis using pycparser

  • 🎨 Beautiful console output with rich

  • ⚙️ Preprocessing support for handling macros and standard headers (gcc -E)

  • 🧩 Modular design — can be used both as a CLI tool or Python module


📦 Installation

From PyPI

pip install halsteadpp

From GitHub

pip install git+https://github.com/Morgadineo/Halsteadpp.git

🚀 Usage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

halsteadpp-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

halsteadpp-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file halsteadpp-0.1.0.tar.gz.

File metadata

  • Download URL: halsteadpp-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for halsteadpp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13e6e08c9286caa83f63140e6ea4f3d685b34eaac3eb11248cde90a3cd9a5594
MD5 e21ba847215f0dfc35d15b655b289701
BLAKE2b-256 1c6a9a508d1621ab52ed8281de34bef4aa6ac57959e792911abfb00f246fcbb7

See more details on using hashes here.

File details

Details for the file halsteadpp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: halsteadpp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for halsteadpp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb331cdd24fb866c0e58bcd750632a83d2b147492a39eb59e750a1e3d5dc0f22
MD5 bd288948b9835b04afd8d9deb4b38433
BLAKE2b-256 0f1cd7ae99d6b7f7583ddd93d4ed1da34fde68905780ffe02ab2523f20a44af0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page