diff --git a/.rubocop.yml b/.rubocop.yml index ca4bdf59..fff07a9e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6827914f..80ba5ae4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 \ No newline at end of file diff --git a/lib/puma/cli.rb b/lib/puma/cli.rb index 2d387214..18a42ac2 100644 --- a/lib/puma/cli.rb +++ b/lib/puma/cli.rb @@ -80,7 +80,7 @@ module Puma @launcher.run end - private + private def unsupported(str) @events.error(str) raise UnsupportedOption diff --git a/lib/puma/control_cli.rb b/lib/puma/control_cli.rb index 2897f630..3343b618 100644 --- a/lib/puma/control_cli.rb +++ b/lib/puma/control_cli.rb @@ -263,7 +263,7 @@ module Puma exit 1 end - private + private def start require 'puma/cli' diff --git a/lib/puma/minissl.rb b/lib/puma/minissl.rb index f281902d..c4b83b05 100644 --- a/lib/puma/minissl.rb +++ b/lib/puma/minissl.rb @@ -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 diff --git a/lib/puma/null_io.rb b/lib/puma/null_io.rb index 62661fbf..6fa830e6 100644 --- a/lib/puma/null_io.rb +++ b/lib/puma/null_io.rb @@ -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 diff --git a/test/test_rack_handler.rb b/test/test_rack_handler.rb index b645b3eb..eeeb80c0 100644 --- a/test/test_rack_handler.rb +++ b/test/test_rack_handler.rb @@ -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