Skip to content

Commit 1a29cff

Browse files
committed
Fix and upgrade Rubocop
1 parent 1fd00e1 commit 1a29cff

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

.rubocop.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ require:
33
- rubocop-rspec
44

55
AllCops:
6-
TargetRubyVersion: 2.3
6+
TargetRubyVersion: 2.4
77

88
Metrics/BlockLength:
99
Exclude:
1010
- "Gemfile"
1111
- "spec/**/*"
1212

13-
Style/BracesAroundHashParameters:
14-
EnforcedStyle: context_dependent
15-
1613
Style/StringLiterals:
1714
EnforcedStyle: double_quotes
1815

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ group :development, :test do
1111
gem "pry"
1212
gem "pry-byebug", platform: :mri
1313

14-
gem "rubocop"
14+
gem "rubocop", "~> 1.8"
1515
gem "rubocop-rspec"
1616
end

lib/yabeda/rails.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# frozen_string_literal: true
22

33
require "yabeda"
4+
require "rails"
45
require "yabeda/rails/railtie"
56

67
module Yabeda
8+
# Minimal set of Rails-specific metrics for using with Yabeda
79
module Rails
810
LONG_RUNNING_REQUEST_BUCKETS = [
911
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, # standard
@@ -19,6 +21,8 @@ def on_controller_action(&block)
1921
controller_handlers << block
2022
end
2123

24+
# Declare metrics and install event handlers for collecting themya
25+
# rubocop: disable Metrics/MethodLength, Metrics/BlockLength, Metrics/AbcSize
2226
def install!
2327
Yabeda.configure do
2428
group :rails
@@ -60,9 +64,10 @@ def install!
6064
end
6165
end
6266
end
67+
# rubocop: enable Metrics/MethodLength, Metrics/BlockLength, Metrics/AbcSize
6368

64-
def ms2s(ms)
65-
(ms.to_f / 1000).round(3)
69+
def ms2s(milliseconds)
70+
(milliseconds.to_f / 1000).round(3)
6671
end
6772
end
6873
end

lib/yabeda/rails/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def rails_server?
1212
end
1313

1414
def puma_server?
15-
::Rails.const_defined?('Puma::CLI')
15+
::Rails.const_defined?("Puma::CLI")
1616
end
1717

1818
def unicorn_server?

spec/yabeda/rails_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
expect(Yabeda::Rails::VERSION).not_to be nil
66
end
77

8-
it "does something useful" do
9-
expect(false).to eq(true)
8+
xit "does something useful" do
9+
# Nothing here
1010
end
1111
end

yabeda-rails.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Gem::Specification.new do |spec|
2222
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2323
spec.require_paths = ["lib"]
2424

25-
spec.add_dependency "yabeda", "~> 0.8"
25+
spec.required_ruby_version = ">= 2.4"
26+
2627
spec.add_dependency "rails"
28+
spec.add_dependency "yabeda", "~> 0.8"
2729

2830
spec.add_development_dependency "bundler", "~> 2.0"
2931
spec.add_development_dependency "rake", "~> 13.0"

0 commit comments

Comments
 (0)