Sha256: 476dbbc15e0b6457f30702e784051e5a94b768c5ad9f6a1c8186afc6f63e694b

Contents?: true

Size: 836 Bytes

Versions: 6787

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # This auto-corrects unused arguments.
    class UnusedArgCorrector
      extend RangeHelp

      class << self
        attr_reader :processed_source

        def correct(processed_source, node)
          return if %i[kwarg kwoptarg].include?(node.type)

          @processed_source = processed_source

          if node.blockarg_type?
            lambda do |corrector|
              range = range_with_surrounding_space(range: node.source_range,
                                                   side: :left)
              range = range_with_surrounding_comma(range, :left)
              corrector.remove(range)
            end
          else
            ->(corrector) { corrector.insert_before(node.loc.name, '_') }
          end
        end
      end
    end
  end
end

Version data entries

6,787 entries across 6,781 versions & 25 rubygems

Version Path
cybrid_api_organization_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.124 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_organization_ruby-0.123.123 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_organization_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.122 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_organization_ruby-0.123.121 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_organization_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.120 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_organization_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.119 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_bank_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb
cybrid_api_id_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/cop/correctors/unused_arg_corrector.rb