Class: CC::Engine::Severity

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/cc/engine/severity.rb

Overview

Converts the HamlLint severity terms to the Code Climate equivalents

Constant Summary collapse

HAML_LINT_TO_CODE_CLIMATE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Maps the HamlLint severity to the Code Climate termoinology

Returns:

  • (Hash)
{
  error: 'minor',
  warning: 'info'
}.freeze

Class Method Summary collapse

Class Method Details

.from_haml_lint(severity) ⇒ String

Converts the HamlLint severity ontology into the Code Climate one

Examples:

CC::Engine::Severity.from_haml_lint("error")

Parameters:

  • severity (String)

    the severity of the issue in HamlLint ontology

Returns:

  • (String)

26
27
28
# File 'lib/cc/engine/severity.rb', line 26

def self.from_haml_lint(severity)
  new(HAML_LINT_TO_CODE_CLIMATE[severity.name] || 'info')
end