Sha256: 34e87e769bbb18215e890fc515ce95caad9ee80d018f1f466685466eeeb1692e

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module SlimLint
  # Searches for multi-line control statements, dynamic output statements,
  # attribute values, and splats.
  class Linter::AvoidMultilineExpressions < Linter
    include LinterRegistry

    on [:slim, :control] do |sexp|
      _, _, code = sexp
      next unless code.size > 2

      msg = "Avoid control statements that span multiple lines."
      report_lint(sexp, msg)
    end

    on [:slim, :output] do |sexp|
      _, _, _, code = sexp
      next unless code.size > 2

      msg = "Avoid dynamic output statements that span multiple lines."
      report_lint(sexp, msg)
    end

    on [:slim, :attrvalue] do |sexp|
      _, _, _, code = sexp
      next unless code.size > 2

      msg = "Avoid attribute values that span multiple lines."
      report_lint(sexp, msg)
    end

    on [:slim, :splat] do |sexp|
      _, _, code = sexp
      next unless code.size > 2

      msg = "Avoid attribute values that span multiple lines."
      report_lint(sexp, msg)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slim_lint_standard-0.0.2.2 lib/slim_lint/linter/avoid_multiline_expressions.rb
slim_lint_standard-0.0.2.1 lib/slim_lint/linter/avoid_multiline_expressions.rb
slim_lint_standard-0.0.2 lib/slim_lint/linter/avoid_multiline_expressions.rb
slim_lint_standard-0.0.1 lib/slim_lint/linter/avoid_multiline_expressions.rb
slim_lint_standard-0.0.0 lib/slim_lint/linter/avoid_multiline_expressions.rb