Class: ERBLint::Linters::ErbSafety
- Inherits:
-
ERBLint::Linter
- Object
- ERBLint::Linter
- ERBLint::Linters::ErbSafety
- Includes:
- ERBLint::LinterRegistry
- Defined in:
- lib/erb_lint/linters/erb_safety.rb
Overview
Detect unsafe ruby interpolations into javascript.
Defined Under Namespace
Classes: ConfigSchema
Constant Summary
Constants included from ERBLint::LinterRegistry
ERBLint::LinterRegistry::CUSTOM_LINTERS_DIR, ERBLint::LinterRegistry::DEPRECATED_CUSTOM_LINTERS_DIR
Instance Attribute Summary
Attributes inherited from ERBLint::Linter
Instance Method Summary collapse
-
#initialize(file_loader, config) ⇒ ErbSafety
constructor
A new instance of ErbSafety.
- #run(processed_source) ⇒ Object
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, #run_and_update_offense_status, support_autocorrect?
Constructor Details
#initialize(file_loader, config) ⇒ ErbSafety
Returns a new instance of ErbSafety.
18 19 20 21 |
# File 'lib/erb_lint/linters/erb_safety.rb', line 18 def initialize(file_loader, config) super @config_filename = @config.better_html_config end |
Instance Method Details
#run(processed_source) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/erb_lint/linters/erb_safety.rb', line 23 def run(processed_source) testers_for(processed_source.parser).each do |tester| tester.validate tester.errors.each do |error| add_offense( error.location, error., ) end end end |