mirror of
https://github.com/lloeki/normandy.git
synced 2025-12-06 01:54:40 +01:00
bumping rubocop
This commit is contained in:
parent
eaa832524e
commit
1fe647876a
6 changed files with 48 additions and 25 deletions
25
.rubocop.yml
25
.rubocop.yml
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 }
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -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 }
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue