Language: Python
Checks: 1
Categories: Compexity
Radon Version: 1.4.2

Radon provides Cyclomatic Complexity checks on both Python 2 and Python 3 code.

Enable the Plugin

To enable Radon analysis, add the following to your .codeclimate.yml configuration file:

plugins:
 radon: 
  enabled: true

More information about the CLI is available in the README here: https://github.com/codeclimate/codeclimate

Configure the Plugin

Radon defaults to assuming the target project is written for Python 3 but can be configured to use Python 2 syntax by specifying python_version in your .codeclimate.yml:

plugins:
  radon: 
    enabled: true
    config: 
      python_version: 2

The Radon engine can be configured to only report issues over (and including) a configured radon Grade threshold. If no threshold is specified, Radon defaults to a "B".

A threshold can be specified in your .codeclimate.yml as follows:

plugins:
  radon: 
    enabled: true
    config: 
      threshold: "C"

The threshold represents the lower bound of complexity scores reported.

For instance, if your radon engine is configured with a threshold of "B", any block of code with a Cyclomatic Complexity of 6 or greater will be reported as an issue.

Understand the Plugin

In penalizing grades for violations, Code Climate assigns remediation points, proportionate to the amount of effort required to repair a software issue.

Code Climate treats complexity violations as one of weightiest because of the effort involved in repair, and penalizes for cyclomatic complexity violations in Python according to the following formula:

    remediation_points = 1,000,000 + (Actual - Threshold) * 100,000

where Threshold is the configured maximum length or McCabe complexity number, and Actual is the score for a given method or code unit.

Radon


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.