Metadata-Version: 2.4
Name: radon-ci
Version: 0.1.0
Summary: Tool for Radon-based cyclomatic complexity and maintainability reports in CI/CD pipelines
Author: Dominik Günzel
License-Expression: Apache-2.0
Project-URL: Repository, https://gitlab.com/dguenzel/radon-ci
Project-URL: Issues, https://gitlab.com/dguenzel/radon-ci/-/issues
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: radon<7,>=6
Provides-Extra: build
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"
Dynamic: license-file

# Radon CI

A Python script that uses [Radon](https://pypi.org/project/radon/) to compute Cyclomatic Complexity and Mantainability Index, and generates output files in OpenMetrics and CodeClimate format. Mainly intended to run in Gitlab CI pipelines.

Disclaimer: Source code is entirely AI-generated.

## Installation

First, create a virtual environment, for example using venv:
```
python3.13 -m venv .venv
source .venv/bin/activate
```

Then install the package:
```
pip install .
```

Or in editable mode:
```
pip install -e .
```

## Usage

To see the full list of program options, type:
```
radon-ci --help
```

Example usage:
```console
(.venv) /path/to/radon-ci$ radon-ci --openmetrics-output metrics.txt --codeclimate-output codeclimate.json --halstead-output halstead.txt src
Code quality report
===================
Source directory    : /path/to/radon-ci/src
Python files        : 3
Code blocks         : 37
Average CC          : 3.08 (rank A)
CC threshold        : <= 10.00 [PASS]
Average MI          : 66.83 (rank A, good)
MI threshold        : >= 50.00 [PASS]
OpenMetrics file    : /path/to/radon-ci/metrics.txt
Code Climate file   : /path/to/radon-ci/codeclimate.json
Code Climate issues : 2
Halstead text file  : /path/to/radon-ci/halstead.txt
Overall status      : PASS

Halstead metrics totals
=======================
h1                 15.000000
h2                 89.000000
N1                 55.000000
N2                 105.000000
vocabulary         104.000000
length             160.000000
calculated_length  615.839053
volume             1050.094090
difficulty         8.787356
effort             8665.475894
time               481.415327
bugs               0.350031

Cyclomatic Complexity breakdown
===============================
src/radon_ci/__init__.py
src/radon_ci/__main__.py
src/radon_ci/cli.py
    F 555:0 main - C (13)
    F 445:0 build_codeclimate_issues - B (8)
    F 145:0 compute_metrics - B (7)
    F 518:0 print_summary - B (6)
    F 109:0 safe_float - A (5)
    F 303:0 block_letter_color - A (4)
    F 323:0 print_all_cc_blocks - A (4)
    F 390:0 severity_for_cc - A (4)
    F 399:0 severity_for_mi - A (4)
    F 40:0 supports_color - A (3)
    F 54:0 iter_python_files - A (3)
    F 60:0 block_letter - A (3)
    F 94:0 mi_rank - A (3)
    F 134:0 collect_blocks_by_file - A (3)
    F 251:0 build_halstead_text_output - A (3)
    F 271:0 mi_color_label - A (3)
    F 357:0 print_mi_breakdown - A (3)
    F 415:0 build_codeclimate_issue - A (3)
    F 48:0 colorize - A (2)
    F 72:0 block_display_name - A (2)
    F 121:0 empty_halstead_totals - A (2)
    F 125:0 halstead_report_to_dict - A (2)
    F 129:0 add_halstead_totals - A (2)
    F 210:0 build_openmetrics - A (2)
    F 267:0 status_label - A (2)
    F 279:0 format_score - A (2)
    F 283:0 relative_display_path - A (2)
    F 291:0 cc_score_color - A (2)
    F 297:0 mi_score_color - A (2)
    F 380:0 print_halstead_totals - A (2)
    F 410:0 fingerprint_for_issue - A (2)
    F 68:0 block_complexity - A (1)
    F 78:0 block_col_offset - A (1)
    F 82:0 build_block_record - A (1)
    F 102:0 build_file_mi_record - A (1)
    F 313:0 format_cc_rank_and_score - A (1)
    F 318:0 format_mi_rank_and_score - A (1)

Maintainability Index breakdown
===============================
src/radon_ci/__init__.py - A (100)
src/radon_ci/__main__.py - A (84.58)
src/radon_ci/cli.py - B (15.90)
```
