Commit 739bb175212446ebd732f98e8e100a4125442baa
1 parent
0c59c718
Exists in
master
and in
1 other branch
Rubocop: auto-fixing linter warnings
Run with "bundle exec rubocop --lint --auto-correct"
Showing
16 changed files
with
24 additions
and
24 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -7,7 +7,7 @@ module ApplicationHelper | @@ -7,7 +7,7 @@ module ApplicationHelper | ||
7 | RiCal.Calendar do |cal| | 7 | RiCal.Calendar do |cal| |
8 | notices.each_with_index do |notice,idx| | 8 | notices.each_with_index do |notice,idx| |
9 | cal.event do |event| | 9 | cal.event do |event| |
10 | - event.summary = "#{idx+1} #{notice.message.to_s}" | 10 | + event.summary = "#{idx+1} #{notice.message}" |
11 | event.description = notice.url if notice.url | 11 | event.description = notice.url if notice.url |
12 | event.dtstart = notice.created_at.utc | 12 | event.dtstart = notice.created_at.utc |
13 | event.dtend = notice.created_at.utc + 60.minutes | 13 | event.dtend = notice.created_at.utc + 60.minutes |
@@ -23,7 +23,7 @@ module ApplicationHelper | @@ -23,7 +23,7 @@ module ApplicationHelper | ||
23 | RiCal.Calendar { |cal| | 23 | RiCal.Calendar { |cal| |
24 | deploys.each_with_index do |deploy,idx| | 24 | deploys.each_with_index do |deploy,idx| |
25 | cal.event do |event| | 25 | cal.event do |event| |
26 | - event.summary = "#{idx+1} #{deploy.repository.to_s}" | 26 | + event.summary = "#{idx+1} #{deploy.repository}" |
27 | event.description = deploy.revision.to_s | 27 | event.description = deploy.revision.to_s |
28 | event.dtstart = deploy.created_at.utc | 28 | event.dtstart = deploy.created_at.utc |
29 | event.dtend = deploy.created_at.utc + 60.minutes | 29 | event.dtend = deploy.created_at.utc + 60.minutes |
app/helpers/problems_helper.rb
@@ -23,7 +23,7 @@ module ProblemsHelper | @@ -23,7 +23,7 @@ module ProblemsHelper | ||
23 | :d => Errbit::Config.gravatar_default, | 23 | :d => Errbit::Config.gravatar_default, |
24 | } | 24 | } |
25 | options.reverse_merge! default_options | 25 | options.reverse_merge! default_options |
26 | - params = options.extract!(:s, :d).delete_if { |k, v| v.blank? } | 26 | + params = options.extract!(:s, :d).delete_if { |_k, v| v.blank? } |
27 | email_hash = Digest::MD5.hexdigest(email) | 27 | email_hash = Digest::MD5.hexdigest(email) |
28 | url = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" | 28 | url = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" |
29 | "#{url}/avatar/#{email_hash}?#{params.to_query}" | 29 | "#{url}/avatar/#{email_hash}?#{params.to_query}" |
app/models/notification_services/campfire_service.rb
@@ -30,7 +30,7 @@ if defined? Campy | @@ -30,7 +30,7 @@ if defined? Campy | ||
30 | # build the campfire client | 30 | # build the campfire client |
31 | campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id) | 31 | campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id) |
32 | # post the issue to the campfire room | 32 | # post the issue to the campfire room |
33 | - campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}/problems/#{problem.id.to_s}" | 33 | + campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}/problems/#{problem.id}" |
34 | end | 34 | end |
35 | end | 35 | end |
36 | end | 36 | end |
app/models/notification_services/flowdock_service.rb
@@ -35,7 +35,7 @@ if defined? Flowdock | @@ -35,7 +35,7 @@ if defined? Flowdock | ||
35 | end | 35 | end |
36 | 36 | ||
37 | def content(problem, url) | 37 | def content(problem, url) |
38 | - full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s}" | 38 | + full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message}" |
39 | <<-MSG.strip_heredoc | 39 | <<-MSG.strip_heredoc |
40 | #{ERB::Util.html_escape full_description}<br> | 40 | #{ERB::Util.html_escape full_description}<br> |
41 | <a href="#{url}">#{url}</a> | 41 | <a href="#{url}">#{url}</a> |
app/models/notification_services/gtalk_service.rb
@@ -46,8 +46,8 @@ class NotificationServices::GtalkService < NotificationService | @@ -46,8 +46,8 @@ class NotificationServices::GtalkService < NotificationService | ||
46 | client.auth(api_token) | 46 | client.auth(api_token) |
47 | 47 | ||
48 | #has to look like this to be formatted properly in the client | 48 | #has to look like this to be formatted properly in the client |
49 | - message = """#{problem.app.name.to_s} | ||
50 | -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} | 49 | + message = """#{problem.app.name} |
50 | +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} | ||
51 | #{notification_description problem}""" | 51 | #{notification_description problem}""" |
52 | 52 | ||
53 | # post the issue to the xmpp room(s) | 53 | # post the issue to the xmpp room(s) |
app/models/notification_services/hoiio_service.rb
@@ -35,7 +35,7 @@ class NotificationServices::HoiioService < NotificationService | @@ -35,7 +35,7 @@ class NotificationServices::HoiioService < NotificationService | ||
35 | 35 | ||
36 | # send sms | 36 | # send sms |
37 | room_id.split(',').each do |number| | 37 | room_id.split(',').each do |number| |
38 | - sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}" | 38 | + sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}" |
39 | end | 39 | end |
40 | 40 | ||
41 | end | 41 | end |
app/models/notification_services/pushover_service.rb
@@ -26,7 +26,7 @@ class NotificationServices::PushoverService < NotificationService | @@ -26,7 +26,7 @@ class NotificationServices::PushoverService < NotificationService | ||
26 | notification = Rushover::Client.new(subdomain) | 26 | notification = Rushover::Client.new(subdomain) |
27 | 27 | ||
28 | # send push notification to pushover | 28 | # send push notification to pushover |
29 | - notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}", :url_title => "Link to error") | 29 | + notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}", :url_title => "Link to error") |
30 | 30 | ||
31 | end | 31 | end |
32 | end | 32 | end |
config/initializers/action_mailer.rb
@@ -26,7 +26,7 @@ end | @@ -26,7 +26,7 @@ end | ||
26 | host: Errbit::Config.host, | 26 | host: Errbit::Config.host, |
27 | port: Errbit::Config.port, | 27 | port: Errbit::Config.port, |
28 | protocol: Errbit::Config.protocol | 28 | protocol: Errbit::Config.protocol |
29 | - }.select { |k, v| v } | 29 | + }.select { |_k, v| v } |
30 | 30 | ||
31 | default.reverse_merge!(options_from_config) | 31 | default.reverse_merge!(options_from_config) |
32 | end | 32 | end |
config/initializers/overrides.rb
config/unicorn.default.rb
@@ -8,7 +8,7 @@ pid ENV['UNICORN_PID'] if ENV['UNICORN_PID'] | @@ -8,7 +8,7 @@ pid ENV['UNICORN_PID'] if ENV['UNICORN_PID'] | ||
8 | 8 | ||
9 | # Taken from github: https://github.com/blog/517-unicorn | 9 | # Taken from github: https://github.com/blog/517-unicorn |
10 | # Though everyone uses pretty miuch the same code | 10 | # Though everyone uses pretty miuch the same code |
11 | -before_fork do |server, worker| | 11 | +before_fork do |server, _worker| |
12 | ## | 12 | ## |
13 | # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and | 13 | # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and |
14 | # immediately start loading up a new version of itself (loaded with a new | 14 | # immediately start loading up a new version of itself (loaded with a new |
@@ -21,7 +21,7 @@ before_fork do |server, worker| | @@ -21,7 +21,7 @@ before_fork do |server, worker| | ||
21 | # Using this method we get 0 downtime deploys. | 21 | # Using this method we get 0 downtime deploys. |
22 | 22 | ||
23 | old_pid = "#{server.config[:pid]}.oldbin" | 23 | old_pid = "#{server.config[:pid]}.oldbin" |
24 | - if File.exists?(old_pid) && server.pid != old_pid | 24 | + if File.exist?(old_pid) && server.pid != old_pid |
25 | begin | 25 | begin |
26 | Process.kill("QUIT", File.read(old_pid).to_i) | 26 | Process.kill("QUIT", File.read(old_pid).to_i) |
27 | rescue Errno::ENOENT, Errno::ESRCH | 27 | rescue Errno::ENOENT, Errno::ESRCH |
spec/fabricators/app_fabricator.rb
@@ -4,7 +4,7 @@ Fabricator(:app) do | @@ -4,7 +4,7 @@ Fabricator(:app) do | ||
4 | end | 4 | end |
5 | 5 | ||
6 | Fabricator(:app_with_watcher, :from => :app) do | 6 | Fabricator(:app_with_watcher, :from => :app) do |
7 | - watchers(:count => 1) { |parent, i| | 7 | + watchers(:count => 1) { |parent, _i| |
8 | Fabricate.build(:watcher, :app => parent) | 8 | Fabricate.build(:watcher, :app => parent) |
9 | } | 9 | } |
10 | end | 10 | end |
spec/fabricators/notification_service_fabricator.rb
@@ -3,7 +3,7 @@ Fabricator :notification_service do | @@ -3,7 +3,7 @@ Fabricator :notification_service do | ||
3 | room_id { sequence :word } | 3 | room_id { sequence :word } |
4 | api_token { sequence :word } | 4 | api_token { sequence :word } |
5 | subdomain { sequence :word } | 5 | subdomain { sequence :word } |
6 | - notify_at_notices { sequence { |a| [0]} } | 6 | + notify_at_notices { sequence { |_a| [0]} } |
7 | end | 7 | end |
8 | 8 | ||
9 | Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do | 9 | Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do |
spec/lib/configurator_spec.rb
@@ -22,7 +22,7 @@ describe Configurator do | @@ -22,7 +22,7 @@ describe Configurator do | ||
22 | 22 | ||
23 | it 'overrides existing variables' do | 23 | it 'overrides existing variables' do |
24 | result = Configurator.run({ | 24 | result = Configurator.run({ |
25 | - one: ['VARONE', ->(values) { 'oveRIIIDE' } ] | 25 | + one: ['VARONE', ->(_values) { 'oveRIIIDE' } ] |
26 | }) | 26 | }) |
27 | expect(result.one).to eq('oveRIIIDE') | 27 | expect(result.one).to eq('oveRIIIDE') |
28 | end | 28 | end |
spec/mailers/mailer_spec.rb
@@ -85,7 +85,7 @@ describe Mailer do | @@ -85,7 +85,7 @@ describe Mailer do | ||
85 | end | 85 | end |
86 | 86 | ||
87 | context 'with a very long message' do | 87 | context 'with a very long message' do |
88 | - let(:notice) { Fabricate(:notice, :message => 6.times.collect{|a| "0123456789" }.join('')) } | 88 | + let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) } |
89 | it "should truncate the long message" do | 89 | it "should truncate the long message" do |
90 | expect(email.subject).to match( / \d{47}\.{3}$/ ) | 90 | expect(email.subject).to match( / \d{47}\.{3}$/ ) |
91 | end | 91 | end |
spec/models/notification_service/gtalk_service_spec.rb
@@ -14,8 +14,8 @@ describe NotificationServices::GtalkService, type: 'model' do | @@ -14,8 +14,8 @@ describe NotificationServices::GtalkService, type: 'model' do | ||
14 | expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) | 14 | expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) |
15 | expect(gtalk).to receive(:connect).with(notification_service.service) | 15 | expect(gtalk).to receive(:connect).with(notification_service.service) |
16 | expect(gtalk).to receive(:auth).with(notification_service.api_token) | 16 | expect(gtalk).to receive(:auth).with(notification_service.api_token) |
17 | - message_value = """#{problem.app.name.to_s} | ||
18 | -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} | 17 | + message_value = """#{problem.app.name} |
18 | +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} | ||
19 | #{notification_service.notification_description problem}""" | 19 | #{notification_service.notification_description problem}""" |
20 | 20 | ||
21 | expect(Jabber::Message).to receive(:new).with(notification_service.user_id, message_value).and_return(message) | 21 | expect(Jabber::Message).to receive(:new).with(notification_service.user_id, message_value).and_return(message) |
@@ -37,8 +37,8 @@ describe NotificationServices::GtalkService, type: 'model' do | @@ -37,8 +37,8 @@ describe NotificationServices::GtalkService, type: 'model' do | ||
37 | @notice = Fabricate :notice | 37 | @notice = Fabricate :notice |
38 | @notification_service = Fabricate :gtalk_notification_service, :app => @notice.app | 38 | @notification_service = Fabricate :gtalk_notification_service, :app => @notice.app |
39 | @problem = @notice.problem | 39 | @problem = @notice.problem |
40 | - @error_msg = """#{@problem.app.name.to_s} | ||
41 | -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s} | 40 | + @error_msg = """#{@problem.app.name} |
41 | +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id} | ||
42 | #{@notification_service.notification_description @problem}""" | 42 | #{@notification_service.notification_description @problem}""" |
43 | 43 | ||
44 | # gtalk stubbing | 44 | # gtalk stubbing |
@@ -106,8 +106,8 @@ describe NotificationServices::GtalkService, type: 'model' do | @@ -106,8 +106,8 @@ describe NotificationServices::GtalkService, type: 'model' do | ||
106 | expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) | 106 | expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) |
107 | expect(gtalk).to receive(:connect) | 107 | expect(gtalk).to receive(:connect) |
108 | expect(gtalk).to receive(:auth).with(notification_service.api_token) | 108 | expect(gtalk).to receive(:auth).with(notification_service.api_token) |
109 | - message_value = """#{problem.app.name.to_s} | ||
110 | -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} | 109 | + message_value = """#{problem.app.name} |
110 | +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} | ||
111 | #{notification_service.notification_description problem}""" | 111 | #{notification_service.notification_description problem}""" |
112 | 112 | ||
113 | expect(Jabber::Message).to receive(:new).with(notification_service.room_id, message_value).and_return(message) | 113 | expect(Jabber::Message).to receive(:new).with(notification_service.room_id, message_value).and_return(message) |
spec/views/problems/show.html.haml_spec.rb
@@ -34,7 +34,7 @@ describe "problems/show.html.haml", type: 'view' do | @@ -34,7 +34,7 @@ describe "problems/show.html.haml", type: 'view' do | ||
34 | allow(controller).to receive(:current_user).and_return(Fabricate(:user)) | 34 | allow(controller).to receive(:current_user).and_return(Fabricate(:user)) |
35 | end | 35 | end |
36 | 36 | ||
37 | - def with_issue_tracker(tracker, problem) | 37 | + def with_issue_tracker(tracker, _problem) |
38 | allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return(trackers) | 38 | allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return(trackers) |
39 | app.issue_tracker = IssueTrackerDecorator.new( | 39 | app.issue_tracker = IssueTrackerDecorator.new( |
40 | IssueTracker.new :type_tracker => tracker, :options => { | 40 | IssueTracker.new :type_tracker => tracker, :options => { |