Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Fix #233 conflicts -> Update rubocop #350

Merged
merged 14 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ Lint/AssignmentInCondition:
Exclude:
# The pattern makes sense here
- 'lib/rspec/support/mutex.rb'

# Over time we'd like to get this down, but this is what we're at now.
Metrics/AbcSize:
Max: 22

# Over time we'd like to get this down, but this is what we're at now.
Metrics/PerceivedComplexity:
Max: 9
2 changes: 1 addition & 1 deletion lib/rspec/support/caller_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def self.first_non_rspec_line(skip_frames=3, increment=5)
return line.to_s if line

skip_frames += increment
increment *= 2 # The choice of two here is arbitrary.
increment *= 2 # The choice of two here is arbitrary.
end
end
else
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/support/comparable_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(string)
@string = string
end

def <=>(other)
def <=>(other) # rubocop:disable Metrics/AbcSize
other = self.class.new(other) unless other.is_a?(self.class)

return 0 if string == other.string
Expand Down
4 changes: 2 additions & 2 deletions lib/rspec/support/method_signature_verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def classify_parameters
end
end

@max_non_kw_args = @min_non_kw_args + optional_non_kw_args
@max_non_kw_args = @min_non_kw_args + optional_non_kw_args
@allowed_kw_args = @required_kw_args + @optional_kw_args
end
else
Expand Down Expand Up @@ -285,7 +285,7 @@ def initialize(signature, args=[])
@arbitrary_kw_args = @unlimited_args = false
end

def with_expectation(expectation) # rubocop:disable MethodLength
def with_expectation(expectation) # rubocop:disable MethodLength, Metrics/PerceivedComplexity
return self unless MethodSignatureExpectation === expectation

if expectation.empty?
Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/support/ruby_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Support
#
# Provides query methods for different OS or OS features.
module OS
module_function
module_function

def windows?
!!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
Expand All @@ -22,7 +22,7 @@ def windows_file_path?
#
# Provides query methods for different rubies
module Ruby
module_function
module_function

def jruby?
RUBY_PLATFORM == 'java'
Expand Down Expand Up @@ -58,7 +58,7 @@ def truffleruby?
# Provides query methods for ruby features that differ among
# implementations.
module RubyFeatures
module_function
module_function

if Ruby.jruby?
# On JRuby 1.7 `--1.8` mode, `Process.respond_to?(:fork)` returns true,
Expand Down
4 changes: 1 addition & 3 deletions lib/rspec/support/spec/in_sub_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module InSubProcess

# Useful as a way to isolate a global change to a subprocess.

# rubocop:disable MethodLength
def in_sub_process(prevent_warnings=true)
def in_sub_process(prevent_warnings=true) # rubocop:disable MethodLength, Metrics/AbcSize
exception_reader, exception_writer = IO.pipe
result_reader, result_writer = IO.pipe

Expand Down Expand Up @@ -46,7 +45,6 @@ def in_sub_process(prevent_warnings=true)
result_reader.close
result
end
# rubocop:enable MethodLength
alias :in_sub_process_if_possible :in_sub_process

def marshal_dump_with_unmarshable_object_handling(object)
Expand Down
1 change: 0 additions & 1 deletion lib/rspec/support/spec/string_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# which also relies on EncodedString. Instead, confirm the
# strings have the same bytes.
RSpec::Matchers.define :be_identical_string do |expected|

if String.method_defined?(:encoding)
match do
expected_encoding? &&
Expand Down