Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rubocop 0.50 #1472

Merged
merged 1 commit into from Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions .rubocop.yml
Expand Up @@ -15,6 +15,10 @@ Layout/SpaceAfterColon:
Layout/SpaceAroundKeyword:
Enabled: true

Layout/SpaceBeforeBlockBraces:
EnforcedStyleForEmptyBraces: no_space
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true

Expand All @@ -33,19 +37,19 @@ Layout/TrailingWhitespace:
Lint/Debugger:
Enabled: true

Style/MethodDefParentheses:
Enabled: true

Style/MethodName:
Naming/MethodName:
Enabled: true
EnforcedStyle: snake_case
Exclude:
- 'test/**/**'

Style/TrailingCommaInArguments:
Naming/VariableName:
Enabled: true

Style/VariableName:
Style/MethodDefParentheses:
Enabled: true

Style/TrailingCommaInArguments:
Enabled: true

Performance/Count:
Expand Down
4 changes: 0 additions & 4 deletions .rubocop_todo.yml
Expand Up @@ -13,10 +13,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true
EnforcedStyle: no_space

# 15 offenses
Layout/SpaceBeforeBlockBraces:
Enabled: true

# 15 offenses
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -11,7 +11,7 @@ gem "minitest-retry"

gem "jruby-openssl", :platform => "jruby"

gem "rubocop", "~> 0.49.1"
gem "rubocop", "~> 0.50.0"

if %w(2.2.7 2.2.8 2.3.4 2.4.1).include? RUBY_VERSION
gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"]
Expand Down
14 changes: 7 additions & 7 deletions examples/puma/client-certs/generate.rb
Expand Up @@ -43,7 +43,7 @@ def issue_cert(dn, key, serial, not_before, not_after, extensions, issuer, issue
ef = OpenSSL::X509::ExtensionFactory.new
ef.subject_certificate = cert
ef.issuer_certificate = issuer
extensions.each{|oid, value, critical|
extensions.each {|oid, value, critical|
cert.add_extension(ef.create_extension(oid, value, critical))
}
cert.sign(issuer_key, digest)
Expand All @@ -69,10 +69,10 @@ def issue_cert(dn, key, serial, not_before, not_after, extensions, issuer, issue
@svr_cert = issue_cert(@svr, @svr_key, 2, now, now+1800_000, ee_exts, @ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
@cli_cert = issue_cert(@cli, @cli_key, 3, now, now+1800_000, ee_exts, @ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)

File.open("ca.crt","wb"){|f| f.print @ca_cert.to_pem }
File.open("ca.key","wb"){|f| f.print @ca_key.to_pem }
File.open("server.crt","wb"){|f| f.print @svr_cert.to_pem }
File.open("server.key","wb"){|f| f.print @svr_key.to_pem }
File.open("client1.crt","wb"){|f| f.print @cli_cert.to_pem }
File.open("client1.key","wb"){|f| f.print @cli_key.to_pem }
File.open("ca.crt","wb") {|f| f.print @ca_cert.to_pem }
File.open("ca.key","wb") {|f| f.print @ca_key.to_pem }
File.open("server.crt","wb") {|f| f.print @svr_cert.to_pem }
File.open("server.key","wb") {|f| f.print @svr_key.to_pem }
File.open("client1.crt","wb") {|f| f.print @cli_cert.to_pem }
File.open("client1.key","wb") {|f| f.print @cli_key.to_pem }
end
2 changes: 1 addition & 1 deletion gemfiles/2.1-Gemfile
Expand Up @@ -11,4 +11,4 @@ gem "minitest-retry"

gem "jruby-openssl", :platform => "jruby"

gem "rubocop", "~> 0.49.1"
gem "rubocop", "~> 0.50.0"
2 changes: 1 addition & 1 deletion lib/puma/cluster.rb
Expand Up @@ -340,7 +340,7 @@ def reload_worker_directory
def stats
old_worker_count = @workers.count { |w| w.phase != @phase }
booted_worker_count = @workers.count { |w| w.booted? }
worker_status = '[' + @workers.map{ |w| %Q!{ "pid": #{w.pid}, "index": #{w.index}, "phase": #{w.phase}, "booted": #{w.booted?}, "last_checkin": "#{w.last_checkin.utc.iso8601}", "last_status": #{w.last_status} }!}.join(",") + ']'
worker_status = '[' + @workers.map { |w| %Q!{ "pid": #{w.pid}, "index": #{w.index}, "phase": #{w.phase}, "booted": #{w.booted?}, "last_checkin": "#{w.last_checkin.utc.iso8601}", "last_status": #{w.last_status} }!}.join(",") + ']'
%Q!{ "workers": #{@workers.size}, "phase": #{@phase}, "booted_workers": #{booted_worker_count}, "old_workers": #{old_worker_count}, "worker_status": #{worker_status} }!
end

Expand Down
2 changes: 1 addition & 1 deletion lib/puma/configuration.rb
Expand Up @@ -180,7 +180,7 @@ def puma_default_options
:worker_shutdown_timeout => DefaultWorkerShutdownTimeout,
:remote_address => :socket,
:tag => method(:infer_tag),
:environment => ->{ ENV['RACK_ENV'] || "development" },
:environment => -> { ENV['RACK_ENV'] || "development" },
:rackup => DefaultRackup,
:logger => STDOUT,
:persistent_timeout => Const::PERSISTENT_TIMEOUT,
Expand Down
2 changes: 1 addition & 1 deletion lib/puma/thread_pool.rb
Expand Up @@ -53,7 +53,7 @@ def initialize(min, max, *extra, &block)
attr_accessor :clean_thread_locals

def self.clean_thread_locals
Thread.current.keys.each do |key|
Thread.current.keys.each do |key| # rubocop: disable Performance/HashEachMethods
Thread.current[key] = nil unless key == :__recursive_key__
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/handler/puma.rb
Expand Up @@ -21,7 +21,7 @@ def self.config(app, options = {})
# contains an array of all explicitly defined user options. We then
# know that all other values are defaults
if user_supplied_options = options.delete(:user_supplied_options)
(options.keys - user_supplied_options).each do |k, v|
(options.keys - user_supplied_options).each do |k|
default_options[k] = options.delete(k)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_rack_handler.rb
Expand Up @@ -145,7 +145,7 @@ def test_config_wins_over_default
FileUtils.mkdir("config")
File.open("config/puma.rb", "w") { |f| f << "port #{file_port}" }

conf = Rack::Handler::Puma.config(-> {}, @options)
conf = Rack::Handler::Puma.config(->{}, @options)
conf.load

assert_equal ["tcp://0.0.0.0:#{file_port}"], conf.options[:binds]
Expand Down