Code Metrics in Python
Project description
Radon is a tool for Python that computes various metrics from the source code. Radon can compute
McCabe’s complexity, i.e. cyclomatic complexity
raw metrics (these include SLOC, comment lines, blank lines, &c.)
Halstead metrics (all of them)
Maintainability Index (the one used in Visual Studio)
Requirements
Radon will run from Python 2.6 to Python 3.3 (endpoints inclusive) with a single code base and without the need of tools like 2to3 or six. It can also run on PyPy without any problems (version tested: 1.9 and 2.0.0).
Radon does not depend on any other Python package.
Installation
With Pip:
$ pip install radon
Or download the source and run the setup file:
$ python setup.py install
Usage
Radon can be used either from the command line or programmatically. Documentation is WIP at https://radon.readthedocs.org/.
Cyclomatic Complexity Example
Quick example:
$ radon cc -anc ../baker/baker.py
../baker/baker.py
M 581:4 Baker.parse_args - D
M 723:4 Baker.parse - D
M 223:4 Baker.command - C
M 796:4 Baker.apply - C
M 857:4 Baker.run - C
32 blocks (classes, functions, methods) analyzed.
Average complexity: B (6.15625)
Explanation:
cc is the radon command
-a tells radon to calculate the average complexity at the end
-nc tells radon to print only results with a complexity rank of C or worse. Other examples: -na (from A to F), or -nd (from D to F).
Actually it’s even better: it’s got colors!
Links
Documentation: https://radon.readthedocs.org
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
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 radon-0.4.tar.gz.
File metadata
- Download URL: radon-0.4.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697ea5c4efdcd9011a7dba7088a18665b5ab537740137ee195cb44f79b41609e
|
|
| MD5 |
cccd6f5a256a23b8e6fd6e3a552ff366
|
|
| BLAKE2b-256 |
013a18f24384f0d52ae0d23d3d6cef10cfde97cd8a10839cd8c17be1aaca3cde
|
File details
Details for the file radon-0.4-py2.py3-none-any.whl.
File metadata
- Download URL: radon-0.4-py2.py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
654b5297f6849c4b0028e07e6481c679890c925db3d13ad5f24a270131550c4a
|
|
| MD5 |
b99dae921c3814fdac8e13bff5610379
|
|
| BLAKE2b-256 |
9d6de1196479c21c4be3f04c2a42ad0376b01ca4356a9a58d2b0692bef8d8c0a
|