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.2.tar.gz (9.1 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.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: viper_ccm-0.1.2.tar.gz
  • Upload date:
  • Size: 9.1 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.2.tar.gz
Algorithm Hash digest
SHA256 f5ed8d7b22ff75cf73ca474bb27b06f0204eb8b2b31649030b0b380b7dff8eff
MD5 f5288175f463560355ea1e8307d7fafb
BLAKE2b-256 e7b2993862617d9b6cc53fb340389f888057d4fb14fa72454654b7d67c7b1e6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: viper_ccm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae483fcc84e4b06298b3b09f47b7c125ea0fadf929424c10c28f35b7744b96b9
MD5 fcfc266272b2d5500e3062b07b2b3390
BLAKE2b-256 7be00e52cbd36f1cfd157887f8f5ae772e46b8dcbf86447afd3f283dc89b5f57

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