diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7f50d8b..deefb00 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,7 +7,7 @@ module ApplicationHelper RiCal.Calendar do |cal| notices.each_with_index do |notice,idx| cal.event do |event| - event.summary = "#{idx+1} #{notice.message.to_s}" + event.summary = "#{idx+1} #{notice.message}" event.description = notice.url if notice.url event.dtstart = notice.created_at.utc event.dtend = notice.created_at.utc + 60.minutes @@ -23,7 +23,7 @@ module ApplicationHelper RiCal.Calendar { |cal| deploys.each_with_index do |deploy,idx| cal.event do |event| - event.summary = "#{idx+1} #{deploy.repository.to_s}" + event.summary = "#{idx+1} #{deploy.repository}" event.description = deploy.revision.to_s event.dtstart = deploy.created_at.utc event.dtend = deploy.created_at.utc + 60.minutes diff --git a/app/helpers/problems_helper.rb b/app/helpers/problems_helper.rb index c8b4bf8..c2d29e4 100644 --- a/app/helpers/problems_helper.rb +++ b/app/helpers/problems_helper.rb @@ -23,7 +23,7 @@ module ProblemsHelper :d => Errbit::Config.gravatar_default, } options.reverse_merge! default_options - params = options.extract!(:s, :d).delete_if { |k, v| v.blank? } + params = options.extract!(:s, :d).delete_if { |_k, v| v.blank? } email_hash = Digest::MD5.hexdigest(email) url = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" "#{url}/avatar/#{email_hash}?#{params.to_query}" diff --git a/app/models/notification_services/campfire_service.rb b/app/models/notification_services/campfire_service.rb index ce28714..3886f9c 100644 --- a/app/models/notification_services/campfire_service.rb +++ b/app/models/notification_services/campfire_service.rb @@ -30,7 +30,7 @@ if defined? Campy # build the campfire client campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id) # post the issue to the campfire room - 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}" + campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}/problems/#{problem.id}" end end end diff --git a/app/models/notification_services/flowdock_service.rb b/app/models/notification_services/flowdock_service.rb index c84dec1..d36ca6f 100644 --- a/app/models/notification_services/flowdock_service.rb +++ b/app/models/notification_services/flowdock_service.rb @@ -35,7 +35,7 @@ if defined? Flowdock end def content(problem, url) - full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s}" + full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message}" <<-MSG.strip_heredoc #{ERB::Util.html_escape full_description}
#{url} diff --git a/app/models/notification_services/gtalk_service.rb b/app/models/notification_services/gtalk_service.rb index 1e39dfc..a209925 100644 --- a/app/models/notification_services/gtalk_service.rb +++ b/app/models/notification_services/gtalk_service.rb @@ -46,8 +46,8 @@ class NotificationServices::GtalkService < NotificationService client.auth(api_token) #has to look like this to be formatted properly in the client - message = """#{problem.app.name.to_s} -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} + message = """#{problem.app.name} +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}""" # post the issue to the xmpp room(s) diff --git a/app/models/notification_services/hoiio_service.rb b/app/models/notification_services/hoiio_service.rb index d8edfe8..8f6471b 100644 --- a/app/models/notification_services/hoiio_service.rb +++ b/app/models/notification_services/hoiio_service.rb @@ -35,7 +35,7 @@ class NotificationServices::HoiioService < NotificationService # send sms room_id.split(',').each do |number| - sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}" + sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}" end end diff --git a/app/models/notification_services/pushover_service.rb b/app/models/notification_services/pushover_service.rb index 6f0402e..f581f72 100644 --- a/app/models/notification_services/pushover_service.rb +++ b/app/models/notification_services/pushover_service.rb @@ -26,7 +26,7 @@ class NotificationServices::PushoverService < NotificationService notification = Rushover::Client.new(subdomain) # send push notification to pushover - 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") + 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") end end diff --git a/config/initializers/action_mailer.rb b/config/initializers/action_mailer.rb index 48a6312..ac64019 100644 --- a/config/initializers/action_mailer.rb +++ b/config/initializers/action_mailer.rb @@ -26,7 +26,7 @@ end host: Errbit::Config.host, port: Errbit::Config.port, protocol: Errbit::Config.protocol - }.select { |k, v| v } + }.select { |_k, v| v } default.reverse_merge!(options_from_config) end diff --git a/config/initializers/overrides.rb b/config/initializers/overrides.rb index 8c3730a..906fa91 100644 --- a/config/initializers/overrides.rb +++ b/config/initializers/overrides.rb @@ -1,7 +1,7 @@ require Rails.root.join('lib/overrides/hoptoad_notifier/hoptoad_notifier') class BSON::ObjectId - def as_json(*args) + def as_json(*_args) to_s end end diff --git a/config/unicorn.default.rb b/config/unicorn.default.rb index 2951dcd..046fe2e 100644 --- a/config/unicorn.default.rb +++ b/config/unicorn.default.rb @@ -8,7 +8,7 @@ pid ENV['UNICORN_PID'] if ENV['UNICORN_PID'] # Taken from github: https://github.com/blog/517-unicorn # Though everyone uses pretty miuch the same code -before_fork do |server, worker| +before_fork do |server, _worker| ## # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and # immediately start loading up a new version of itself (loaded with a new @@ -21,7 +21,7 @@ before_fork do |server, worker| # Using this method we get 0 downtime deploys. old_pid = "#{server.config[:pid]}.oldbin" - if File.exists?(old_pid) && server.pid != old_pid + if File.exist?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH diff --git a/spec/fabricators/app_fabricator.rb b/spec/fabricators/app_fabricator.rb index fe2b859..7437f67 100644 --- a/spec/fabricators/app_fabricator.rb +++ b/spec/fabricators/app_fabricator.rb @@ -4,7 +4,7 @@ Fabricator(:app) do end Fabricator(:app_with_watcher, :from => :app) do - watchers(:count => 1) { |parent, i| + watchers(:count => 1) { |parent, _i| Fabricate.build(:watcher, :app => parent) } end diff --git a/spec/fabricators/notification_service_fabricator.rb b/spec/fabricators/notification_service_fabricator.rb index 82fb6fb..154387b 100644 --- a/spec/fabricators/notification_service_fabricator.rb +++ b/spec/fabricators/notification_service_fabricator.rb @@ -3,7 +3,7 @@ Fabricator :notification_service do room_id { sequence :word } api_token { sequence :word } subdomain { sequence :word } - notify_at_notices { sequence { |a| [0]} } + notify_at_notices { sequence { |_a| [0]} } end Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do diff --git a/spec/lib/configurator_spec.rb b/spec/lib/configurator_spec.rb index 74a4ce4..6bc5500 100644 --- a/spec/lib/configurator_spec.rb +++ b/spec/lib/configurator_spec.rb @@ -22,7 +22,7 @@ describe Configurator do it 'overrides existing variables' do result = Configurator.run({ - one: ['VARONE', ->(values) { 'oveRIIIDE' } ] + one: ['VARONE', ->(_values) { 'oveRIIIDE' } ] }) expect(result.one).to eq('oveRIIIDE') end diff --git a/spec/mailers/mailer_spec.rb b/spec/mailers/mailer_spec.rb index e7ac839..cdcc3f5 100644 --- a/spec/mailers/mailer_spec.rb +++ b/spec/mailers/mailer_spec.rb @@ -85,7 +85,7 @@ describe Mailer do end context 'with a very long message' do - let(:notice) { Fabricate(:notice, :message => 6.times.collect{|a| "0123456789" }.join('')) } + let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) } it "should truncate the long message" do expect(email.subject).to match( / \d{47}\.{3}$/ ) end diff --git a/spec/models/notification_service/gtalk_service_spec.rb b/spec/models/notification_service/gtalk_service_spec.rb index 6319033..387fe2b 100644 --- a/spec/models/notification_service/gtalk_service_spec.rb +++ b/spec/models/notification_service/gtalk_service_spec.rb @@ -14,8 +14,8 @@ describe NotificationServices::GtalkService, type: 'model' do expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) expect(gtalk).to receive(:connect).with(notification_service.service) expect(gtalk).to receive(:auth).with(notification_service.api_token) - message_value = """#{problem.app.name.to_s} -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} + message_value = """#{problem.app.name} +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_service.notification_description problem}""" 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 @notice = Fabricate :notice @notification_service = Fabricate :gtalk_notification_service, :app => @notice.app @problem = @notice.problem - @error_msg = """#{@problem.app.name.to_s} -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s} + @error_msg = """#{@problem.app.name} +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id} #{@notification_service.notification_description @problem}""" # gtalk stubbing @@ -106,8 +106,8 @@ describe NotificationServices::GtalkService, type: 'model' do expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk) expect(gtalk).to receive(:connect) expect(gtalk).to receive(:auth).with(notification_service.api_token) - message_value = """#{problem.app.name.to_s} -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} + message_value = """#{problem.app.name} +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_service.notification_description problem}""" expect(Jabber::Message).to receive(:new).with(notification_service.room_id, message_value).and_return(message) diff --git a/spec/views/problems/show.html.haml_spec.rb b/spec/views/problems/show.html.haml_spec.rb index 375a89e..0056785 100644 --- a/spec/views/problems/show.html.haml_spec.rb +++ b/spec/views/problems/show.html.haml_spec.rb @@ -34,7 +34,7 @@ describe "problems/show.html.haml", type: 'view' do allow(controller).to receive(:current_user).and_return(Fabricate(:user)) end - def with_issue_tracker(tracker, problem) + def with_issue_tracker(tracker, _problem) allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return(trackers) app.issue_tracker = IssueTrackerDecorator.new( IssueTracker.new :type_tracker => tracker, :options => { -- libgit2 0.21.2