Class: ERBLint::Linters::RequireScriptNonce

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

Overview

Allow inline script tags in ERB that have a nonce attribute. This only validates inline <script> tags, as well as rails helpers like javascript_tag.

Constant Summary

Constants included from ERBLint::LinterRegistry

ERBLint::LinterRegistry::CUSTOM_LINTERS_DIR

Instance Attribute Summary

Attributes inherited from ERBLint::Linter

#offenses

Instance Method Summary collapse

Methods included from ERBLint::LinterRegistry

clear, find_by_name, included, linters, load_custom_linters

Methods inherited from ERBLint::Linter

#add_offense, #clear_offenses, #enabled?, #excludes_file?, inherited, #initialize, support_autocorrect?

Constructor Details

This class inherits a constructor from ERBLint::Linter

Instance Method Details

#run(processed_source) ⇒ Object



13
14
15
16
17
18
# File 'lib/erb_lint/linters/require_script_nonce.rb', line 13

def run(processed_source)
  parser = processed_source.parser

  find_html_script_tags(parser)
  find_rails_helper_script_tags(parser)
end