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
casestatement counts +1) - modified_ccm (mccabe-style cyclomatic complexity metric, Modified:
switchstatement 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
uvas package/project management tool - use
uv run <script>to run scripts - put code under
srcfile
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5ed8d7b22ff75cf73ca474bb27b06f0204eb8b2b31649030b0b380b7dff8eff
|
|
| MD5 |
f5288175f463560355ea1e8307d7fafb
|
|
| BLAKE2b-256 |
e7b2993862617d9b6cc53fb340389f888057d4fb14fa72454654b7d67c7b1e6b
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae483fcc84e4b06298b3b09f47b7c125ea0fadf929424c10c28f35b7744b96b9
|
|
| MD5 |
fcfc266272b2d5500e3062b07b2b3390
|
|
| BLAKE2b-256 |
7be00e52cbd36f1cfd157887f8f5ae772e46b8dcbf86447afd3f283dc89b5f57
|