Sha256: 2f89aea67783838fe982c7aa86e3ed9d02978aa8655c1476deaf9a1111f9aacf

Contents?: true

Size: 605 Bytes

Versions: 25

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module PlatformosCheck
  #
  # Unwanted:
  #
  # {{ x | some_unknown_filter }}
  #
  # Wanted:
  #
  # {{ x | upcase }}
  #
  class UnknownFilter < LiquidCheck
    severity :error
    category :liquid
    doc docs_url(__FILE__)

    def on_variable(node)
      used_filters = node.filters.map { |name, *_rest| name }
      undefined_filters = used_filters - PlatformosLiquid::Filter.labels - PlatformosLiquid::Filter.aliases

      undefined_filters.each do |undefined_filter|
        add_offense("Undefined filter `#{undefined_filter}`", node:)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
platformos-check-0.4.14 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.13 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.12 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.11 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.10 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.9 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.8 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.7 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.6 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.5 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.4 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.3 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.2 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.1 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.4.0 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.3.3 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.3.1 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.3.0 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.2.2 lib/platformos_check/checks/unknown_filter.rb
platformos-check-0.2.1 lib/platformos_check/checks/unknown_filter.rb