Sha256: f3f2e648d94a6ce8cd7053916ffc60106762b05813a336fd37edcd786c97a211

Contents?: true

Size: 704 Bytes

Versions: 7

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  class DeprecatedFilter < LiquidCheck
    doc "https://shopify.dev/docs/themes/liquid/reference/filters/deprecated-filters"
    category :liquid
    severity :suggestion

    def on_variable(node)
      used_filters = node.value.filters.map { |name, *_rest| name }
      used_filters.each do |filter|
        alternatives = ShopifyLiquid::DeprecatedFilter.alternatives(filter)
        next unless alternatives

        alternatives = alternatives.map { |alt| "`#{alt}`" }
        add_offense(
          "Deprecated filter `#{filter}`, consider using an alternative: #{alternatives.join(', ')}",
          node: node,
        )
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
theme-check-0.4.0 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.3.3 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.3.2 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.3.1 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.3.0 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.2.2 lib/theme_check/checks/deprecated_filter.rb
theme-check-0.2.0 lib/theme_check/checks/deprecated_filter.rb