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
viper_ccm-0.1.4.tar.gz
(9.7 kB
view details)
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
viper_ccm-0.1.4-py3-none-any.whl
(16.8 kB
view details)
File details
Details for the file viper_ccm-0.1.4.tar.gz.
File metadata
- Download URL: viper_ccm-0.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bc102af4bd40de3f3ac391226d52e94bfc3e9900836c8de9e6561325d910b4f
|
|
| MD5 |
7ef5c35ea466351af42726df12818321
|
|
| BLAKE2b-256 |
3b95187903f6619f940c4667c1feeaff141d2a410fe4d0f8d58395e0d825e0c4
|
File details
Details for the file viper_ccm-0.1.4-py3-none-any.whl.
File metadata
- Download URL: viper_ccm-0.1.4-py3-none-any.whl
- Upload date:
- Size: 16.8 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 |
78fc498936ad50bafd69b944eae29210365e418ec084d8a62cc8f54362b9b282
|
|
| MD5 |
1e81c40e61c30827d813bbf58b30c15a
|
|
| BLAKE2b-256 |
2af32f780b54c2df0ca42f74a1f7ace442b399cb86cce83fc27cf46264f3aea9
|