Skip to main content

Calculate code metrics in various languages

Project description

Build status PyPI version Python version Downloads Language grade: Python

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multimetric-1.0.5.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

multimetric-1.0.5-py3.7.egg (20.4 kB view details)

Uploaded Source

File details

Details for the file multimetric-1.0.5.tar.gz.

File metadata

  • Download URL: multimetric-1.0.5.tar.gz
  • Upload date:
  • Size: 7.1 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

Hashes for multimetric-1.0.5.tar.gz
Algorithm Hash digest
SHA256 5cdf305299b00adefde13b988079f53ede1468aa23c3c590f3f871a412981b94
MD5 e93f6543d93b4a9bfb150ad26a81ce4d
BLAKE2b-256 77de743d803b964fb92a4d7a849a1b5eedf40acbb11988d90ddc0f2146b6e445

See more details on using hashes here.

File details

Details for the file multimetric-1.0.5-py3.7.egg.

File metadata

  • Download URL: multimetric-1.0.5-py3.7.egg
  • Upload date:
  • Size: 20.4 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

Hashes for multimetric-1.0.5-py3.7.egg
Algorithm Hash digest
SHA256 375a6774c637c786ca265dc14a373b870e1e01d631f3b13a731b8a3141724168
MD5 c9c92210cc35e17b5627781d8fbfa7ba
BLAKE2b-256 5cf6086f5ce1e49d7458d03fab2877d7ac232424dae10785d86b17e1e5caff05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page