From a21ce09a0b98bb998bb34e79f6426a7d188ba154 Mon Sep 17 00:00:00 2001 From: Laust Rud Jacobsen Date: Mon, 12 Oct 2015 21:54:23 +0200 Subject: [PATCH] Rubocop: fix all uses of !! - replace with thing.present? --- .rubocop_todo.yml | 17 ++++------------- Gemfile | 2 +- app/controllers/apps_controller.rb | 2 +- app/helpers/apps_helper.rb | 2 +- app/models/app.rb | 5 +++-- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8439143..1b447c3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2015-10-12 21:40:48 +0200 using RuboCop version 0.34.2. +# on 2015-10-12 21:53:36 +0200 using RuboCop version 0.34.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -13,13 +13,13 @@ Metrics/AbcSize: # Offense count: 5 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 203 + Max: 205 # Offense count: 5 Metrics/CyclomaticComplexity: Max: 11 -# Offense count: 458 +# Offense count: 457 # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: Max: 239 @@ -64,7 +64,7 @@ Style/AlignHash: - 'spec/controllers/problems_controller_spec.rb' - 'spec/models/problem_spec.rb' -# Offense count: 7 +# Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. Style/AlignParameters: @@ -72,7 +72,6 @@ Style/AlignParameters: - 'app/helpers/apps_helper.rb' - 'app/models/app.rb' - 'app/models/notification_services/gtalk_service.rb' - - 'app/models/problem.rb' - 'config/initializers/devise.rb' # Offense count: 105 @@ -146,14 +145,6 @@ Style/Documentation: Style/DotPosition: Enabled: false -# Offense count: 6 -Style/DoubleNegation: - Exclude: - - 'Gemfile' - - 'app/controllers/apps_controller.rb' - - 'app/helpers/apps_helper.rb' - - 'app/models/app.rb' - # Offense count: 5 Style/EachWithObject: Exclude: diff --git a/Gemfile b/Gemfile index 7d12c80..2a8bc5e 100644 --- a/Gemfile +++ b/Gemfile @@ -100,7 +100,7 @@ group :test do end group :heroku, :production do - gem 'rails_12factor', require: !!ENV["HEROKU"] + gem 'rails_12factor', require: ENV.key?("HEROKU") gem 'unicorn', require: false, platform: 'ruby' end diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index d2a251c..962b08e 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -20,7 +20,7 @@ class AppsController < ApplicationController end expose(:all_errs) { - !!params[:all_errs] + params[:all_errs].present? } expose(:problems) { diff --git a/app/helpers/apps_helper.rb b/app/helpers/apps_helper.rb index 886311c..a2f83e6 100644 --- a/app/helpers/apps_helper.rb +++ b/app/helpers/apps_helper.rb @@ -45,7 +45,7 @@ module AppsHelper @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 + @any_deploys ||= app.last_deploy_at.present? @any_notification_services ||= app.notification_service_configured? end end diff --git a/app/models/app.rb b/app/models/app.rb index e2b6543..3d87ee0 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -135,11 +135,12 @@ class App def issue_tracker_configured? - !!issue_tracker && !!(issue_tracker.configured?) + issue_tracker.present? && issue_tracker.configured? end def notification_service_configured? - !!(notification_service.class < NotificationService && notification_service.configured?) + (notification_service.class < NotificationService) && + notification_service.configured? end -- libgit2 0.21.2