Skip to main content

Summary

FeatureStatusNotes
MaintainabilityComplexity, duplication, code smells
Linting
Auto-formatting
Custom checks
Security scanningAppSec, dependencies, and secrets
Code metrics
Code coverage

Details

Maintainability
ComplexityAka cognitive complexity
Cyclomatic complexity
Identical code duplication
Similar code duplication
Code smells
Linters
RuboCopRuby static code analyzer and formatter
ReekCode smell detector for Ruby
StandardRBRuby style guide, linter, and formatter
BrakemanStatic analysis security vulnerability scanner
Auto-formatters
RuboCopIncludes formatting capabilities
StandardRBZero-config Ruby formatter
Custom checks
ast-grep
Semgrep
ripgrep
Security scanning
BrakemanAppSec (SAST) for Ruby on Rails applications
GitleaksSecrets scanning
OSV-ScannerDependency scanning (SCA)
SemgrepAppSec (SAST)
TrivyDependency scanning (SCA)
TruffleHogSecrets scanning
Code coverage
SimpleCov
Cobertura coverage format
JSON coverage format

File extensions

By default, Ruby files are defined as:
[file_types.ruby]
globs = [
  "*.rb",
  "*.rake",
  "**/.irbrc",
  "**/.pryrc",
  "**/Appraisals",
  "**/Berksfile",
  "**/Brewfile",
  "**/buildfile",
  "**/Buildfile",
  "**/Capfile",
  "**/Dangerfile",
  "**/Deliverfile",
  "**/Fastfile",
  "**/Gemfile",
  "**/Guardfile",
  "**/Jarfile",
  "**/Mavenfile",
  "**/Podfile",
  "**/Puppetfile",
  "**/Rakefile",
  "**/Snapfile",
  "**/Thorfile",
  "**/Vagrantfile",
]
interpreters = ["jruby", "rbx", "rake", "macruby", "ruby"]
These patterns can be overridden from qlty.toml.

Code coverage setup

QLTY supports code coverage for Ruby through SimpleCov. For a full working example, see our example Ruby repository.

SimpleCov configuration

To instrument test coverage with SimpleCov:
  1. Install SimpleCov:
gem install simplecov
  1. Configure SimpleCov to generate JSON reports:
require 'simplecov'
require 'simplecov_json_formatter'
SimpleCov.start do
    formatter SimpleCov::Formatter::JSONFormatter
    add_filter '/spec/'
end
If you want to combine the JSON format with other formats, use SimpleCov’s MultiFormatter:
SimpleCov.start do
    formatter SimpleCov::Formatter::MultiFormatter.new([
      SimpleCov::Formatter::JSONFormatter,
      SimpleCov::Formatter::HTMLFormatter
    ])
    add_filter '/spec/'
end
  1. Publish SimpleCov’s JSON coverage reports using qlty coverage publish:
qlty coverage publish coverage/coverage.json
For GitHub Actions users, you can use our example workflow.

Supported Ruby versions

We officially support Ruby 2.5 and later for maintainability checks and code coverage. SimpleCov version 0.22.0+ is recommended for code coverage. Each plugin may have its own version requirements.