Sha256: bb7c80855fb109fedb15157d48c5dc2771b070b086a0bbeb5c30f603912815e9
Contents?: true
Size: 955 Bytes
Versions: 11
Compression:
Stored size: 955 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RBS module Lint # Checks that there are no repeated overload bodies # # @example default # # bad # def foo: () -> void # | () -> void # class DuplicateOverload < RuboCop::RBS::CopBase MSG = 'Duplicate overload body detected.' def on_rbs_def(decl) overloads = decl.overloads overloads.each_with_index do |overload, idx| next if idx == overloads.size - 1 next_overloads = overloads[(idx + 1)..-1] next_overloads.each do |next_overload| next unless overload.method_type == next_overload.method_type range = location_to_range(next_overload.method_type.location) add_offense(range) end end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems