bumping rubocop

This commit is contained in:
Loic Nageleisen 2016-02-14 16:44:33 +01:00
parent eaa832524e
commit 1fe647876a
6 changed files with 48 additions and 25 deletions

View file

@ -1,3 +1,6 @@
AllCops:
TargetRubyVersion: 2.0
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
@ -7,5 +10,25 @@ Style/FileName:
Style/Semicolon: Style/Semicolon:
AllowAsExpressionSeparator: true AllowAsExpressionSeparator: true
Style/TrailingComma: Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma EnforcedStyleForMultiline: comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Style/SignalException:
EnforcedStyle: semantic
Style/ClassAndModuleChildren:
EnforcedStyle: compact
Style/TrivialAccessors:
AllowPredicates: true
Style/Alias:
EnforcedStyle: prefer_alias_method
Lint/ShadowingOuterLocalVariable:
Exclude:
- examples/many_to_one.rb
- examples/one_to_many.rb

View file

@ -5,11 +5,11 @@ require 'channel'
c = Channel.new c = Channel.new
1.upto(5) do |i| 1.upto(5) do |i|
go(lambda { |i, co| go(lambda do |i, co|
1.upto(5) do |j| 1.upto(5) do |j|
co << format("hi from %d.%d", i, j) co << format('hi from %d.%d', i, j)
end end
}, i, c) end, i, c)
end end
25.times { puts c.recv } 25.times { puts c.recv }

View file

@ -12,14 +12,14 @@ Channel.select(messages) do |msg, c|
end end
end end
msg = 'hi' # msg = 'hi'
messages <- msg # messages <- msg
#select { # select {
#case messages <- msg: # case messages <- msg:
# fmt.Println("sent message", msg) # fmt.Println("sent message", msg)
#default: # default:
# fmt.Println("no message sent") # fmt.Println("no message sent")
#} # }
Channel.select(messages, signals) do |res, c| Channel.select(messages, signals) do |res, c|
case c case c

View file

@ -8,15 +8,15 @@ w = WaitGroup.new
w.add(5) w.add(5)
1.upto(5) do |i| 1.upto(5) do |i|
go(lambda { |i, ci| go(lambda do |i, ci|
j = 1 j = 1
ci.each { |v| ci.each do |v|
sleep(0.001) sleep(0.001)
puts format("%d.%d got %d", i, j, v) puts format('%d.%d got %d', i, j, v)
j += 1 j += 1
} end
w.done w.done
}, i, c) end, i, c)
end end
1.upto(25) { |i| c << i } 1.upto(25) { |i| c << i }

View file

@ -8,9 +8,9 @@ require 'channel'
class TestChannel < Test::Unit::TestCase class TestChannel < Test::Unit::TestCase
module Util module Util
def meanwhile(*procs, &blk) def meanwhile(*procs)
threads = procs.map { |p| Thread.new(&p) } threads = procs.map { |p| Thread.new(&p) }
blk.call yield
threads.each(&:join) threads.each(&:join)
end end
end end

View file

@ -7,9 +7,9 @@ require 'channel/waitgroup'
class TestWaitGroup < Test::Unit::TestCase class TestWaitGroup < Test::Unit::TestCase
module Util module Util
def meanwhile(*procs, &blk) def meanwhile(*procs)
threads = procs.map { |p| Thread.new(&p) } threads = procs.map { |p| Thread.new(&p) }
blk.call yield
threads.each(&:join) threads.each(&:join)
end end
end end