Sha256: 690fa3cab2e12e35280468646ec25ab51e0f731b38caed92cb68b464b29fe219

Contents?: true

Size: 770 Bytes

Versions: 282

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

require "rubocop"
require "ariadne/view_components/statuses"
require_relative "../../../../app/lib/ariadne/view_helper"

module RuboCop
  module Cop
    module Ariadne
      # :nodoc:
      class BaseCop < RuboCop::Cop::Cop
        # We only verify SystemArguments if it's a `.new` call on a component or
        # a ViewHeleper call.
        def valid_node?(node)
          return if node.nil?

          view_helpers.include?(node.method_name) || (node.method_name == :new && !node.receiver.nil? && ::Ariadne::ViewComponents::STATUSES.key?(node.receiver.const_name))
        end

        private def view_helpers
          ::Ariadne::ViewHelper::HELPERS.keys.map { |key| "ariadne_#{key}".to_sym }
        end
      end
    end
  end
end

Version data entries

282 entries across 282 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.41-aarch64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.41-x86_64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.41-arm64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.41-x86_64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.41-x64-mingw-ucrt lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.41 lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40-x86_64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40-x64-mingw-ucrt lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40-aarch64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40-arm64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40-x86_64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.40 lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-x86_64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-x86_64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-x64-mingw32 lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-aarch64-linux lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-x64-mingw-ucrt lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39-arm64-darwin lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.39 lib/rubocop/cop/ariadne/base_cop.rb
ariadne_view_components-0.0.38-x64-mingw32 lib/rubocop/cop/ariadne/base_cop.rb