Skip to content

Commit

Permalink
Merge pull request #423 from tnir/tnir/reenable-rubocop-with-ruby-2.3…
Browse files Browse the repository at this point in the history
…-compat

Apply RuboCop linting for Ruby 2.3
  • Loading branch information
hsbt committed May 10, 2022
2 parents eabd220 + 180938b commit 90797d1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
9 changes: 3 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ AllCops:
- rake.gemspec
- bin/*

Metrics/LineLength:
Enabled: true
Max: 120

Style/HashSyntax:
Enabled: true

Expand All @@ -23,8 +19,9 @@ Style/MultilineIfThen:
Style/MethodDefParentheses:
Enabled: true

Style/BracesAroundHashParameters:
Layout/LineLength:
Enabled: true
Max: 120

Layout/IndentationWidth:
Enabled: true
Expand All @@ -35,7 +32,7 @@ Layout/Tab:
Layout/EmptyLines:
Enabled: true

Layout/TrailingBlankLines:
Layout/TrailingEmptyLines:
Enabled: true

Layout/TrailingWhitespace:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ group :development do
gem "bundler"
gem "minitest"
gem "coveralls"
gem "rubocop"
gem "rubocop", "~> 0.81.0"
end
4 changes: 2 additions & 2 deletions lib/rake/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ def execute(args=nil)
application.trace "** Execute #{name}" if application.options.trace
application.enhance_with_matching_rule(name) if @actions.empty?
if opts = Hash.try_convert(args) and !opts.empty?
@actions.each { |act| act.call(self, args, **opts)}
@actions.each { |act| act.call(self, args, **opts) }
else
@actions.each { |act| act.call(self, args)}
@actions.each { |act| act.call(self, args) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_clean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestRakeClean < Rake::TestCase # :nodoc:
def test_clean
if RUBY_ENGINE == 'truffleruby' and RUBY_ENGINE_VERSION.start_with?('19.3.')
if RUBY_ENGINE == "truffleruby" and RUBY_ENGINE_VERSION.start_with?("19.3.")
load "rake/clean.rb" # TruffleRuby 19.3 does not set self correctly with wrap=true
else
load "rake/clean.rb", true
Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_file_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def test_clone_and_dup
assert_equal ["a", "b", "c"], d
end

if RUBY_VERSION < '2.7'
if RUBY_VERSION < "2.7"
def test_dup_and_clone_replicate_taint
a = FileList["a", "b", "c"]
a.taint
Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_can_triple_invoke_after_exception_with_reenable
next if !raise_exception

raise_exception = false
raise 'Some error'
raise "Some error"
end

assert_raises(RuntimeError) { t1.invoke }
Expand Down
18 changes: 9 additions & 9 deletions test/test_rake_test_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,20 @@ def test_task_prerequisites_deps
end

def test_task_order_only_prerequisites
t = task(a: 'b') {
t = task(a: "b") {
:aaa
} | 'c'
b, c = task('b'), task('c')
assert_equal ['b'], t.prerequisites
assert_equal ['c'], t.order_only_prerequisites
} | "c"
b, c = task("b"), task("c")
assert_equal ["b"], t.prerequisites
assert_equal ["c"], t.order_only_prerequisites
assert_equal [b, c], t.prerequisite_tasks
end

def test_task_order_only_prerequisites_key
t = task 'a' => 'b', order_only: ['c']
b, c = task('b'), task('c')
assert_equal ['b'], t.prerequisites
assert_equal ['c'], t.order_only_prerequisites
t = task "a" => "b", order_only: ["c"]
b, c = task("b"), task("c")
assert_equal ["b"], t.prerequisites
assert_equal ["c"], t.order_only_prerequisites
assert_equal [b, c], t.prerequisite_tasks
end
end

0 comments on commit 90797d1

Please sign in to comment.