We’re pleased to announce that we’ve honed our grades for Ruby analysis on the Code Climate Platform, to produce results closer to those provided by our Classic analysis. Specifically, we’ve increased the penalties for Ruby complexity and duplication. As a result, Ruby repos analyzed on the platform may see a decline in GPA of up to a full point. Repositories with significant Complexity and Duplication violations will be most strongly impacted.
For Ruby duplication checks we’ve updated the penalty formula to give more base weight for each violation, and a small penalty per unit over permitted duplication mass threshold.
For Ruby complexity checks (via the RuboCop engine), changes include:
- Enable Method length check, and increase default maximum from 10 to 30
- Increase default Class length max from 150 to 250
- Increase default Module length max from 150 to 250
- Enable Cyclomatic complexity check
- Disable ABCSize check
Of course, as the Code Climate Platform offers the ability to configure the engines, categories of checks, and even individual checks running on your project, you can always adjust the new thresholds to better meet the requirements of your team.
Configuring Complexity Checks in the RuboCop engine
RuboCop provides several different metrics which can be used to help assess the maintainability of code, including ABCSize, ClassLength, MethodLength, ModuleLength, ParameterLists, CyclomaticComplexity, and PerceivedComplexity.
As part of this grading update, we’ve updated the default settings in the
.rubocop.yml generated when a user has ruby code and no
.codeclimate.yml config file. This includes a suggested set of settings in your
.rubocop.yml for assessing software complexity. If you’re using the auto-generated config for your analysis you may see changes in your reported issues.
Configuring the Duplication engine for Ruby analysis
rubocop complexity checks, you can can optionally tune your own tolerance for duplication mass by updating the engine configuration in your
.codeclimate.yml. Code Climate’s suggested and default threshold for Ruby is 18.