diff --git a/.rubocop.yml b/.rubocop.yml index df2a352..d75634c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -31,3 +31,9 @@ Style/AlignParameters: Style/IndentHash: EnforcedStyle: consistent + +Style/SpaceAroundOperators: + MultiSpaceAllowedForOperators: + - '=' + - '=>' + - '||=' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index cd9a33d..bb04417 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -317,21 +317,6 @@ Style/SingleSpaceBeforeFirstArg: Style/SpaceAroundEqualsInParameterDefault: Enabled: false -# Offense count: 28 -# Cop supports --auto-correct. -# Configuration parameters: MultiSpaceAllowedForOperators. -Style/SpaceAroundOperators: - Exclude: - - 'app/controllers/api/v1/problems_controller.rb' - - 'app/helpers/application_helper.rb' - - 'app/helpers/apps_helper.rb' - - 'app/helpers/hash_helper.rb' - - 'app/models/issue_tracker.rb' - - 'app/models/notification_service.rb' - - 'config/load.rb' - - 'spec/controllers/problems_controller_spec.rb' - - 'spec/models/notice_observer_spec.rb' - # Offense count: 27 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/controllers/api/v1/problems_controller.rb b/app/controllers/api/v1/problems_controller.rb index 861f599..9119a5f 100644 --- a/app/controllers/api/v1/problems_controller.rb +++ b/app/controllers/api/v1/problems_controller.rb @@ -24,7 +24,7 @@ class Api::V1::ProblemsController < ApplicationController if params.key?(:start_date) && params.key?(:end_date) start_date = Time.parse(params[:start_date]).utc end_date = Time.parse(params[:end_date]).utc - query = {:first_notice_at=>{"$lte"=>end_date}, "$or"=>[{:resolved_at=>nil}, {:resolved_at=>{"$gte"=>start_date}}]} + query = {:first_notice_at => {"$lte" => end_date}, "$or" => [{:resolved_at => nil}, {:resolved_at => {"$gte" => start_date}}]} end results = benchmark("[api/v1/problems_controller/index] query time") do diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2982cb0..451adb2 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}" + 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}" + 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/hash_helper.rb b/app/helpers/hash_helper.rb index f415e92..7a01e3b 100644 --- a/app/helpers/hash_helper.rb +++ b/app/helpers/hash_helper.rb @@ -9,11 +9,11 @@ module HashHelper sorted_keys = hash.keys.sort sorted_keys.each do |key| val = hash[key].is_a?(Hash) ? pretty_hash(hash[key], nesting) : hash[key].inspect - pretty += "\n#{' '*nesting*tab_size}" + pretty += "\n#{' ' * nesting * tab_size}" pretty += "#{key.inspect} => #{val}" pretty += "," unless key == sorted_keys.last end nesting -= 1 - pretty += "\n#{' '*nesting*tab_size}}" + pretty += "\n#{' ' * nesting * tab_size}}" end end diff --git a/app/models/notification_service.rb b/app/models/notification_service.rb index 78aa7a4..6bf006b 100644 --- a/app/models/notification_service.rb +++ b/app/models/notification_service.rb @@ -40,7 +40,7 @@ class NotificationService # Allows us to set the issue tracker class from a single form. def type; _type; end - def type=(t); self._type=t; end + def type=(t); self._type = t; end def url; nil; end diff --git a/config/load.rb b/config/load.rb index e808b6a..6c9e9d9 100644 --- a/config/load.rb +++ b/config/load.rb @@ -52,8 +52,7 @@ Errbit::Config = Configurator.run({ smtp_password: %w(SMTP_PASSWORD SENDGRID_PASSWORD), smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', ->(values) { values[:smtp_domain] || - (values[:email_from] && values[:email_from].split('@').last)|| - nil + (values[:email_from] && values[:email_from].split('@').last) || nil }], # sendmail settings diff --git a/spec/controllers/problems_controller_spec.rb b/spec/controllers/problems_controller_spec.rb index 4351766..9d0b188 100644 --- a/spec/controllers/problems_controller_spec.rb +++ b/spec/controllers/problems_controller_spec.rb @@ -95,8 +95,8 @@ describe ProblemsController, type: 'controller' do before do sign_in user @app = Fabricate(:app) - @problem1 = Fabricate(:problem, :app=>@app, message: "Most important") - @problem2 = Fabricate(:problem, :app=>@app, message: "Very very important") + @problem1 = Fabricate(:problem, :app => @app, message: "Most important") + @problem2 = Fabricate(:problem, :app => @app, message: "Very very important") end it "renders successfully" do @@ -380,8 +380,8 @@ describe ProblemsController, type: 'controller' do before do sign_in user @app = Fabricate(:app) - @problem1 = Fabricate(:problem, :app=>@app) - @problem2 = Fabricate(:problem, :app=>@app) + @problem1 = Fabricate(:problem, :app => @app) + @problem2 = Fabricate(:problem, :app => @app) end it "destroys all problems" do diff --git a/spec/models/notice_observer_spec.rb b/spec/models/notice_observer_spec.rb index c2a5a51..b210c07 100644 --- a/spec/models/notice_observer_spec.rb +++ b/spec/models/notice_observer_spec.rb @@ -6,9 +6,9 @@ describe "Callback on Notice", type: 'model' do message: "some message", backtrace: [ { - "number"=>"425", - "file"=>"[GEM_ROOT]/callbacks.rb", - "method"=>"__callbacks" + "number" => "425", + "file" => "[GEM_ROOT]/callbacks.rb", + "method" => "__callbacks" } ], request: { "component" => "application" }, @@ -18,9 +18,9 @@ describe "Callback on Notice", type: 'model' do }, api_key: api_key, notifier: { - "name"=>"Hoptoad Notifier", - "version"=>"2.3.2", - "url"=>"http://hoptoadapp.com" + "name" => "Hoptoad Notifier", + "version" => "2.3.2", + "url" => "http://hoptoadapp.com" }, framework: "Rails: 3.2.11" } -- libgit2 0.21.2