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.1.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.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: viper_ccm-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b81a1c5359939177692641cc271b995c9f18e78cadf2c1cd9b52e1d0fbbd99b1
MD5 6611d87b5784ad2b8a7a458606c6f211
BLAKE2b-256 c36f2a90668dc699c4a6db7954b06d160df49774bc7bfd36d7316627d7d760f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: viper_ccm-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42705973e7dfd8082df77471ad241494b437ee71d6f99a95dd748f0d561c23ea
MD5 ee63f2fbd45552d03b4aa0c93f0a3eae
BLAKE2b-256 368b8851777325e26964a137891c62cb298773a87e0301e7542530e65883b2d5

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