Sha256: 9722cf5cbf8612ccc1886db8212e0905b5c4a5686161b137763940fd22f84a06

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module SlimLint
  # Checks for forbidden embedded engines.
  class Linter::EmbeddedEngines < Linter
    include LinterRegistry

    MESSAGE = 'Forbidden embedded engine `%s` found'

    on_start do |_sexp|
      forbidden_engines = config['forbidden_engines']
      dummy_node = Struct.new(:line)
      document.source_lines.each_with_index do |line, index|
        forbidden_engines.each do |forbidden_engine|
          next unless line =~ /^\s*#{forbidden_engine}.*:\s*$/

          report_lint(dummy_node.new(index + 1), MESSAGE % forbidden_engine)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slim_lint-0.31.1 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.31.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.30.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.29.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.28.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.27.0 lib/slim_lint/linter/embedded_engines.rb