Skip to content

Commit

Permalink
Merge pull request #46 from Shopify/handle-other-multipart-warning
Browse files Browse the repository at this point in the history
Handle the other two part warning from Ruby 2.7
  • Loading branch information
casperisfine authored Apr 28, 2020
2 parents ab2c3f3 + 34d614a commit cdd8ee4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ Style/IfWithSemicolon:
Style/IdenticalConditionalBranches:
Enabled: true

Layout/IndentationStyle:
Enabled: true

Style/InfiniteLoop:
Enabled: true

Expand Down Expand Up @@ -803,9 +806,6 @@ Layout/SpaceInsideRangeLiteral:
Style/SymbolLiteral:
Enabled: true

Layout/Tab:
Enabled: true

Layout/TrailingWhitespace:
Enabled: true

Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ inherit_from:
- https://shopify.github.io/ruby-style-guide/rubocop.yml

AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.4
Exclude:
- gemfiles/vendor/**/*

Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GEM
jaro_winkler (1.5.4)
minitest (5.11.3)
parallel (1.19.1)
parser (2.7.1.0)
parser (2.7.1.1)
ast (~> 2.4.0)
rainbow (3.0.0)
rake (12.3.2)
Expand All @@ -39,7 +39,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.81.0)
rubocop (0.82.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
Expand Down
11 changes: 9 additions & 2 deletions lib/deprecation_toolkit/warning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ module Warning

@buffer = nil

# Ruby 2.7 has a warning for improper use of keyword arguments that is sent as two parts
# Ruby 2.7 has two warnings for improper use of keyword arguments that are sent in two parts
# Example:
#
# /path/to/caller.rb:1: warning: Using the last argument as keyword parameters is deprecated; \
# maybe ** should be added to the call
# /path/to/calleee.rb:1: warning: The called method `method_name' is defined here
#
# /path/to/caller.rb:1: warning: Passing the keyword argument as the last hash parameter is deprecated
# /path/to/calleee.rb:1: warning: The called method `method_name' is defined here
def two_part_warning?(str)
str.end_with?("maybe ** should be added to the call\n")
str.end_with?(
"maybe ** should be added to the call\n",
"Passing the keyword argument as the last hash parameter is deprecated\n",
)
end

def handle_multipart(str)
Expand Down

0 comments on commit cdd8ee4

Please sign in to comment.