Class: ERBLint::Linters::DeprecatedClasses

Inherits:
ERBLint::Linter show all
Includes:
ERBLint::LinterRegistry
Defined in:
lib/erb_lint/linters/deprecated_classes.rb

Overview

Checks for deprecated classes in the start tags of HTML elements.

Constant Summary

Constants included from ERBLint::LinterRegistry

ERBLint::LinterRegistry::CUSTOM_LINTERS_DIR

Instance Method Summary collapse

Methods included from ERBLint::LinterRegistry

included, load_custom_linters

Methods inherited from ERBLint::Linter

inherited, #lint_file

Constructor Details

#initialize(config) ⇒ DeprecatedClasses

Returns a new instance of DeprecatedClasses.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/erb_lint/linters/deprecated_classes.rb', line 9

def initialize(config)
  @deprecated_ruleset = []
  config.fetch('rule_set', []).each do |rule|
    suggestion = rule.fetch('suggestion', '')
    rule.fetch('deprecated', []).each do |class_expr|
      @deprecated_ruleset.push(
        class_expr: class_expr,
        suggestion: suggestion
      )
    end
  end
  @deprecated_ruleset.freeze

  @addendum = config.fetch('addendum', '')
end