Sha256: 1e92863fe66b8a0a851aacbcfe5a745f78081823218f3afcbb40251ccbc6b84b

Contents?: true

Size: 620 Bytes

Versions: 8

Compression:

Stored size: 620 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 =~ /^#{forbidden_engine}.*:\s*$/

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slim_lint-0.26.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.25.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.24.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.23.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.22.1 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.22.0 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.21.1 lib/slim_lint/linter/embedded_engines.rb
slim_lint-0.21.0 lib/slim_lint/linter/embedded_engines.rb