Class: ERBLint::Linters::Agent::NoSpecificAttributes

Inherits:
ERBLint::Linter
  • Object
show all
Includes:
ERBLint::LinterRegistry, CustomHelpers
Defined in:
lib/erblint/agent/linters/agent/no_specific_attributes.rb

Overview

Linter that checks for forbidden HTML attributes in ERB templates.

Defined Under Namespace

Classes: ConfigSchema

Constant Summary collapse

ATTR_REGEX =
/(\w+(?:-\w+)*)\s*=\s*["']/

Instance Method Summary collapse

Methods included from CustomHelpers

#generate_offense, #generate_offense_from_source_range, #simple_class_name, #tags

Instance Method Details

#run(processed_source) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/erblint/agent/linters/agent/no_specific_attributes.rb', line 25

def run(processed_source)
  return if @config.forbidden_attributes.empty?

  file_content = processed_source.file_content

  scan_attributes(processed_source, file_content)
end