Class: HamlLint::Linter::MultilineScript

Inherits:
HamlLint::Linter show all
Includes:
HamlLint::LinterRegistry
Defined in:
lib/haml_lint/linter/multiline_script.rb

Overview

Checks scripts spread over multiple lines.

Constant Summary collapse

SPLIT_OPERATORS =

List of operators that can split a script into two lines that we want to alert on.

%w[
  || or && and
  ||= &&=
  ^ << >> | &
  <<= >>= |= &=
  + - * / ** %
  += -= *= /= **= %=
  < <= <=> >= >
  = == === != =~ !~
  .. ...
  ? :
  not
  if unless while until
  begin
].to_set

Instance Attribute Summary

Attributes inherited from HamlLint::Linter

#lints

Instance Method Summary collapse

Methods included from HamlLint::LinterRegistry

extract_linters_from, included

Methods inherited from HamlLint::Linter

#initialize, #name, #run, #run_or_raise, supports_autocorrect?, #supports_autocorrect?

Methods included from HamlVisitor

#visit, #visit_children

Constructor Details

This class inherits a constructor from HamlLint::Linter

Instance Method Details

#visit_script(node) ⇒ Object



26
27
28
# File 'lib/haml_lint/linter/multiline_script.rb', line 26

def visit_script(node)
  check(node)
end

#visit_silent_script(node) ⇒ Object



30
31
32
# File 'lib/haml_lint/linter/multiline_script.rb', line 30

def visit_silent_script(node)
  check(node)
end