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:
Enabled: false
@ -7,5 +10,25 @@ Style/FileName:
Style/Semicolon:
AllowAsExpressionSeparator: true
Style/TrailingComma:
Style/TrailingCommaInLiteral:
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
1.upto(5) do |i|
go(lambda { |i, co|
go(lambda do |i, co|
1.upto(5) do |j|
co << format("hi from %d.%d", i, j)
co << format('hi from %d.%d', i, j)
end
}, i, c)
end, i, c)
end
25.times { puts c.recv }

View file

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

View file

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

View file

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

View file

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