diff --git a/.rubocop.yml b/.rubocop.yml index 463aad3..8ebf83e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,3 +11,6 @@ Rails/FindBy: Style/EmptyLineBetweenDefs: AllowAdjacentOneLineDefs: true + +Style/ExtraSpacing: + AllowForAlignment: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 226a93a..9fc1a9a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -147,12 +147,6 @@ Style/EachWithObject: - 'app/models/notice_fingerprinter.rb' - 'lib/recurse.rb' -# Offense count: 22 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment. -Style/ExtraSpacing: - Enabled: false - # Offense count: 2 # Configuration parameters: Exclude. Style/FileName: diff --git a/Gemfile b/Gemfile index 57b026d..2900531 100644 --- a/Gemfile +++ b/Gemfile @@ -29,7 +29,7 @@ gem 'htmlentities' gem 'kaminari', '>= 0.14.1' gem 'mongoid', '5.0.0' gem 'mongoid_rails_migrations' -gem 'rack-ssl', :require => 'rack/ssl' # force SSL +gem 'rack-ssl', :require => 'rack/ssl' # force SSL gem 'rack-ssl-enforcer', :require => false gem 'rails_autolink' gem 'useragent' @@ -104,7 +104,7 @@ group :heroku, :production do gem 'unicorn', require: false, platform: 'ruby' end -gem 'therubyracer', :platform => :ruby # C Ruby (MRI) or Rubinius, but NOT Windows +gem 'therubyracer', :platform => :ruby # C Ruby (MRI) or Rubinius, but NOT Windows gem 'sass-rails' gem 'uglifier' # We can't upgrade because not compatible to jquery >= 1.9. diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index 8c208b5..958b783 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -17,7 +17,7 @@ class Api::V1::NoticesController < ApplicationController respond_to do |format| format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path - format.xml { render :xml => results } + format.xml { render :xml => results } end end end diff --git a/app/controllers/api/v1/problems_controller.rb b/app/controllers/api/v1/problems_controller.rb index e506276..861f599 100644 --- a/app/controllers/api/v1/problems_controller.rb +++ b/app/controllers/api/v1/problems_controller.rb @@ -14,7 +14,7 @@ class Api::V1::ProblemsController < ApplicationController respond_to do |format| format.any(:html, :json) { render :json => result } # render JSON if no extension specified on path - format.xml { render :xml => result } + format.xml { render :xml => result } end end @@ -33,7 +33,7 @@ class Api::V1::ProblemsController < ApplicationController respond_to do |format| format.any(:html, :json) { render :json => JSON.dump(results) } # render JSON if no extension specified on path - format.xml { render :xml => results } + format.xml { render :xml => results } end end end diff --git a/app/controllers/api/v1/stats_controller.rb b/app/controllers/api/v1/stats_controller.rb index 8f9409d..f4a3e09 100644 --- a/app/controllers/api/v1/stats_controller.rb +++ b/app/controllers/api/v1/stats_controller.rb @@ -19,7 +19,7 @@ class Api::V1::StatsController < ApplicationController respond_to do |format| format.any(:html, :json) { render :json => JSON.dump(stats) } # render JSON if no extension specified on path - format.xml { render :xml => stats } + format.xml { render :xml => stats } end end diff --git a/app/helpers/apps_helper.rb b/app/helpers/apps_helper.rb index a2f83e6..2676883 100644 --- a/app/helpers/apps_helper.rb +++ b/app/helpers/apps_helper.rb @@ -42,10 +42,10 @@ module AppsHelper @any_github_repos = @any_issue_trackers = @any_deploys = @any_bitbucket_repos = @any_notification_services = false apps.each do |app| - @any_github_repos ||= app.github_repo? - @any_bitbucket_repos ||= app.bitbucket_repo? - @any_issue_trackers ||= app.issue_tracker_configured? - @any_deploys ||= app.last_deploy_at.present? + @any_github_repos ||= app.github_repo? + @any_bitbucket_repos ||= app.bitbucket_repo? + @any_issue_trackers ||= app.issue_tracker_configured? + @any_deploys ||= app.last_deploy_at.present? @any_notification_services ||= app.notification_service_configured? end end diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 62ce57f..7b4e461 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -3,7 +3,7 @@ module FormHelper return unless document.errors.any? content_tag(:div, :class => 'error-messages') do - body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.') + body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.') body + content_tag(:ul) do document.errors.full_messages.inject('') {|errs, msg| errs + content_tag(:li, h(msg)) }.html_safe end diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 1d55f46..c87f38b 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -28,8 +28,8 @@ class Mailer < ActionMailer::Base end def deploy_notification(deploy) - @deploy = deploy - @app = AppDecorator.new deploy.app + @deploy = deploy + @app = AppDecorator.new deploy.app errbit_headers 'App' => @app.name, 'Environment' => @deploy.environment, diff --git a/app/models/issue_tracker.rb b/app/models/issue_tracker.rb index 6c45fe4..ad4eac0 100644 --- a/app/models/issue_tracker.rb +++ b/app/models/issue_tracker.rb @@ -22,7 +22,7 @@ class IssueTracker end def type_tracker - attributes['type_tracker'] ? attributes['type_tracker'] : 'none' + attributes['type_tracker'] ? attributes['type_tracker'] : 'none' end # Allow the tracker to validate its own params diff --git a/app/models/notification_services/gtalk_service.rb b/app/models/notification_services/gtalk_service.rb index 0197fb9..ff88a39 100644 --- a/app/models/notification_services/gtalk_service.rb +++ b/app/models/notification_services/gtalk_service.rb @@ -46,7 +46,7 @@ class NotificationServices::GtalkService < NotificationService client.auth(api_token) #has to look like this to be formatted properly in the client - message = """#{problem.app.name} + message = """#{problem.app.name} #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}""" diff --git a/bin/rails b/bin/rails index f8da2cf..bd79dce 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' diff --git a/config.ru b/config.ru index fb56fe7..76d9bb0 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,5 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('../config/environment', __FILE__) use Rack::Deflater run Rails.application diff --git a/config/routes.rb b/config/routes.rb index 1dac2ec..220abec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,7 +20,7 @@ Rails.application.routes.draw do end end - resources :problems, :only => [:index] do + resources :problems, :only => [:index] do collection do post :destroy_several post :resolve_several diff --git a/lib/hoptoad.rb b/lib/hoptoad.rb index 2e4a150..a5a50ab 100644 --- a/lib/hoptoad.rb +++ b/lib/hoptoad.rb @@ -18,7 +18,7 @@ module Hoptoad def self.get_version_processor(version) case version when /2\.[01234]/ then Hoptoad::V2 - else; raise ApiVersionError + else; raise ApiVersionError end end end diff --git a/spec/fabricators/app_fabricator.rb b/spec/fabricators/app_fabricator.rb index 7437f67..6a38543 100644 --- a/spec/fabricators/app_fabricator.rb +++ b/spec/fabricators/app_fabricator.rb @@ -12,7 +12,7 @@ end Fabricator(:watcher) do app watcher_type 'email' - email { sequence(:email){|n| "email#{n}@example.com"} } + email { sequence(:email){|n| "email#{n}@example.com"} } end Fabricator(:user_watcher, :from => :watcher) do diff --git a/spec/fabricators/comment_fabricator.rb b/spec/fabricators/comment_fabricator.rb index e96d1de..21565b0 100644 --- a/spec/fabricators/comment_fabricator.rb +++ b/spec/fabricators/comment_fabricator.rb @@ -1,6 +1,6 @@ Fabricator :comment do user - body 'Test comment' + body 'Test comment' err(:fabricator => :problem) end diff --git a/spec/fabricators/notification_service_fabricator.rb b/spec/fabricators/notification_service_fabricator.rb index 154387b..bcdb495 100644 --- a/spec/fabricators/notification_service_fabricator.rb +++ b/spec/fabricators/notification_service_fabricator.rb @@ -1,4 +1,4 @@ -Fabricator :notification_service do +Fabricator :notification_service do app room_id { sequence :word } api_token { sequence :word } diff --git a/spec/mailers/mailer_spec.rb b/spec/mailers/mailer_spec.rb index cdcc3f5..bb795bc 100644 --- a/spec/mailers/mailer_spec.rb +++ b/spec/mailers/mailer_spec.rb @@ -51,7 +51,7 @@ describe Mailer do p.notices_count = 3 p end - let!(:user) { Fabricate(:admin) } + let!(:user) { Fabricate(:admin) } let(:error_report) do instance_double( 'ErrorReport', -- libgit2 0.21.2