Skip to main content

a code complexity reporter

Project description

Viper - a code complexity metrics reporter

Input

all kinds of source code files

Output

For each file, list of functiton information. For a function, analyze to get following data: - scope (namespace, class or function as ancester nodes of this function)

  • fqdn (fully qualified domain name: scope + name)
  • name (the identifier)
  • signature (normalized function signature, keep unchanged when compiled function name is not changed)
  • line (line number of identifier)
  • start (start line number of function definition)
  • end (end line number of function definition)
  • ccm (mccabe-style cyclomatic complexity metric, Traditional: each case statement counts +1)
  • modified_ccm (mccabe-style cyclomatic complexity metric, Modified: switch statement counts +1)
  • statements (number of statements in the function body)

Supported Languages

  • C (.c, .h)
  • C++ (.cpp, .cxx, .cc, .hpp, .hxx, .hh)
  • Python (.py, .pyw)
  • SystemVerilog (.sv, .svh)

Output Formats

Viper supports multiple output formats out of the box. Use the --format option:

  • default: Human-readable list of functions (default)
  • pmccabe: pmccabe-compatible tab-separated format (Modified CCM, Traditional CCM, Statements, First line, # Lines, filename(line): function_name)

Implementation Idea

  • use python 3.14.2
  • utilize tree_sitter module and tree_sitter_xxx language packs to parse source code to get AST, then analyze AST to get function information
  • support inputs of multiple files, enumeration of files in directories.

project and module management

  • use tool uv as package/project management tool
  • use uv run <script> to run scripts
  • put code under src file

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

viper_ccm-0.1.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

viper_ccm-0.1.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file viper_ccm-0.1.3.tar.gz.

File metadata

  • Download URL: viper_ccm-0.1.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for viper_ccm-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2a511ea569a6d4d00a78afff9e8a747fbc13668af1987a56927e38c90f9142c6
MD5 ea0eb8fba0fb81ea1b3080cb65b90608
BLAKE2b-256 54e46c68d7bd022669e830dcd4ea1b4f841b1ba76953f6e0c66417b61eec8538

See more details on using hashes here.

File details

Details for the file viper_ccm-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: viper_ccm-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for viper_ccm-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f9644aecfb978e56fdbce978894d17571c48d703b0d97dc0a47b76176306bb45
MD5 ea2bfd3c69b7ba2ac8f687d26b4b307e
BLAKE2b-256 578b42a0ba78a311e93df13ef76b126e4a9881407d6959213ba53a628a4fcbda

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