improved rubocop config (#2152)

This commit is contained in:
Nate Berkopec 2020-03-07 08:15:43 -06:00 committed by GitHub
parent 27ed7b1dc1
commit 2cef8ddae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 38 deletions

View File

@ -6,6 +6,8 @@ AllCops:
Exclude:
- 'tmp/**/*'
- 'vendor/**/*'
- 'examples/**/*'
- 'pkg/**/*'
- 'Rakefile'
Layout/SpaceAfterColon:
@ -53,3 +55,24 @@ Style/TrailingCommaInArguments:
Performance:
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

View File

@ -39,19 +39,7 @@ Layout/EmptyLinesAroundModuleBody:
# 5 offenses
Layout/IndentationWidth:
Enabled: true
# 3 offenses
Layout/AccessModifierIndentation:
EnforcedStyle: indent
# 2 offenses
Style/WhileUntilModifier:
Enabled: true
# 1 offense
Style/TernaryParentheses:
Enabled: true
# >200 offenses for 80
# 58 offenses for 100
# 18 offenses for 120
@ -64,19 +52,3 @@ Metrics/LineLength:
- https
IgnoreCopDirectives: false
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

View File

@ -80,7 +80,7 @@ module Puma
@launcher.run
end
private
private
def unsupported(str)
@events.error(str)
raise UnsupportedOption

View File

@ -263,7 +263,7 @@ module Puma
exit 1
end
private
private
def start
require 'puma/cli'

View File

@ -141,9 +141,7 @@ module Puma
# Read any drop any partially initialized sockets and any received bytes during shutdown.
# Don't let this socket hold this loop forever.
# 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))
end
return if [:timeout, :eof].include?(read_and_drop(1)) while should_drop_bytes?
rescue IOError, SystemCallError
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
# nothing

View File

@ -15,7 +15,7 @@ module Puma
# Mimics IO#read with no data.
#
def read(count = nil, _buffer = nil)
(count && count > 0) ? nil : ""
count && count > 0 ? nil : ""
end
def rewind

View File

@ -33,9 +33,7 @@ class TestPathHandler < Minitest::Test
# Wait for launcher to boot
Timeout.timeout(10) do
until @launcher
sleep 1
end
sleep 1 until @launcher
end
sleep 1