Calculate code metrics in various languages
Project description
Calculate code metrics in various languages
Purpose
This tool tries to calculate the following metrics for many, many programming languages
Comment to Code percentage
Cyclomatic complexity according to McCabe
Number of delivered bugs according to Halstead
Time required to program according to Halstead
Difficulty according to Halstead
Volume according to Halstead
Effort according to Halstead
Lines of code
Maintainability index
This tool was heavily inspired by metrics
Requirements
python3
Installation
PyPi
simply run
pip3 install multimetric
From source
Install the needed requirements by running pip3 install pygments
git clone this repository
cd to <clone folder>
run python3 setup.py build
Usage
usage: multimetric [-h] [--bugpredict {old,new}]
[--maintindex {sei,classic,microsoft}]
files [files ...]
Calculate code metrics in various languages
positional arguments:
files Files to parse
optional arguments:
-h, --help show this help message and exit
--bugpredict {old,new}
Method how to calculate the bug prediction
--maintindex {sei,classic,microsoft}
Method how to calculate the maintainability index
By default tool guesses the content type by the filename, if that doesn’t work for you please see below
Output
Output will be written to stdout as json.
Output structure
files contains a list of each file passed by CLI
overall contains the calculated values for all passed files
Item structure
comment_ratio = Comment to Code percentage
cyclomatic_complexity = Cyclomatic complexity according to McCabe
halstead_bugprop = Number of delivered bugs according to Halstead
halstead_timerequired = Time required to program according to Halstead
halstead_difficulty = Difficulty according to Halstead
halstead_volume = Volume according to Halstead
halstead_effort = Effort according to Halstead
lang = list of idendified programming languages
loc = Lines of code
maintainability_index = Maintainability index
operands_sum = Number of used operands
operands_uniq = Number of unique used operands
operators_sum = Number of used operators
operators_uniq = Number of unique used operators
Further reading
Bugs & Contribution
Feel free to create issues or pull requests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file multimetric-1.0.2.tar.gz
.
File metadata
- Download URL: multimetric-1.0.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a73e0ee42931f5a24597e0d4b0938f01af2fd8f7a69bf1e0ec6f8463f9fbf95 |
|
MD5 | 801c72eebfa276878897f7567e473899 |
|
BLAKE2b-256 | 70cfe8ed469a5f6decd5b8b2156002b6501e0ee66073966236b200517851bb5d |