improved rubocop config (#2152)
This commit is contained in:
parent
27ed7b1dc1
commit
2cef8ddae1
23
.rubocop.yml
23
.rubocop.yml
|
@ -6,6 +6,8 @@ AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'tmp/**/*'
|
- 'tmp/**/*'
|
||||||
- 'vendor/**/*'
|
- 'vendor/**/*'
|
||||||
|
- 'examples/**/*'
|
||||||
|
- 'pkg/**/*'
|
||||||
- 'Rakefile'
|
- 'Rakefile'
|
||||||
|
|
||||||
Layout/SpaceAfterColon:
|
Layout/SpaceAfterColon:
|
||||||
|
@ -53,3 +55,24 @@ Style/TrailingCommaInArguments:
|
||||||
|
|
||||||
Performance:
|
Performance:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
Max: 7
|
||||||
|
|
||||||
|
Performance/RedundantMatch:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/RedundantBlockCall:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/StringReplacement:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/AccessModifierIndentation:
|
||||||
|
EnforcedStyle: indent
|
||||||
|
|
||||||
|
Style/WhileUntilModifier:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Style/TernaryParentheses:
|
||||||
|
Enabled: true
|
||||||
|
|
|
@ -39,19 +39,7 @@ Layout/EmptyLinesAroundModuleBody:
|
||||||
# 5 offenses
|
# 5 offenses
|
||||||
Layout/IndentationWidth:
|
Layout/IndentationWidth:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# 3 offenses
|
|
||||||
Layout/AccessModifierIndentation:
|
|
||||||
EnforcedStyle: indent
|
|
||||||
|
|
||||||
# 2 offenses
|
|
||||||
Style/WhileUntilModifier:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# 1 offense
|
|
||||||
Style/TernaryParentheses:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# >200 offenses for 80
|
# >200 offenses for 80
|
||||||
# 58 offenses for 100
|
# 58 offenses for 100
|
||||||
# 18 offenses for 120
|
# 18 offenses for 120
|
||||||
|
@ -64,19 +52,3 @@ Metrics/LineLength:
|
||||||
- https
|
- https
|
||||||
IgnoreCopDirectives: false
|
IgnoreCopDirectives: false
|
||||||
IgnoredPatterns: []
|
IgnoredPatterns: []
|
||||||
|
|
||||||
# 1 offense
|
|
||||||
Metrics/ParameterLists:
|
|
||||||
Max: 5
|
|
||||||
|
|
||||||
# 1 offense
|
|
||||||
Performance/RedundantMatch:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# 1 offense
|
|
||||||
Performance/RedundantBlockCall:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# 1 offense
|
|
||||||
Performance/StringReplacement:
|
|
||||||
Enabled: true
|
|
|
@ -80,7 +80,7 @@ module Puma
|
||||||
@launcher.run
|
@launcher.run
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def unsupported(str)
|
def unsupported(str)
|
||||||
@events.error(str)
|
@events.error(str)
|
||||||
raise UnsupportedOption
|
raise UnsupportedOption
|
||||||
|
|
|
@ -263,7 +263,7 @@ module Puma
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def start
|
def start
|
||||||
require 'puma/cli'
|
require 'puma/cli'
|
||||||
|
|
||||||
|
|
|
@ -141,9 +141,7 @@ module Puma
|
||||||
# Read any drop any partially initialized sockets and any received bytes during shutdown.
|
# Read any drop any partially initialized sockets and any received bytes during shutdown.
|
||||||
# Don't let this socket hold this loop forever.
|
# Don't let this socket hold this loop forever.
|
||||||
# If it can't send more packets within 1s, then give up.
|
# If it can't send more packets within 1s, then give up.
|
||||||
while should_drop_bytes?
|
return if [:timeout, :eof].include?(read_and_drop(1)) while should_drop_bytes?
|
||||||
return if [:timeout, :eof].include?(read_and_drop(1))
|
|
||||||
end
|
|
||||||
rescue IOError, SystemCallError
|
rescue IOError, SystemCallError
|
||||||
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
|
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
|
||||||
# nothing
|
# nothing
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Puma
|
||||||
# Mimics IO#read with no data.
|
# Mimics IO#read with no data.
|
||||||
#
|
#
|
||||||
def read(count = nil, _buffer = nil)
|
def read(count = nil, _buffer = nil)
|
||||||
(count && count > 0) ? nil : ""
|
count && count > 0 ? nil : ""
|
||||||
end
|
end
|
||||||
|
|
||||||
def rewind
|
def rewind
|
||||||
|
|
|
@ -33,9 +33,7 @@ class TestPathHandler < Minitest::Test
|
||||||
|
|
||||||
# Wait for launcher to boot
|
# Wait for launcher to boot
|
||||||
Timeout.timeout(10) do
|
Timeout.timeout(10) do
|
||||||
until @launcher
|
sleep 1 until @launcher
|
||||||
sleep 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue