Commit a21ce09a0b98bb998bb34e79f6426a7d188ba154

Authored by Laust Rud Jacobsen
1 parent c8514607
Exists in master and in 1 other branch production

Rubocop: fix all uses of !! - replace with thing.present?

.rubocop_todo.yml
1 1 # This configuration was generated by
2 2 # `rubocop --auto-gen-config`
3   -# on 2015-10-12 21:40:48 +0200 using RuboCop version 0.34.2.
  3 +# on 2015-10-12 21:53:36 +0200 using RuboCop version 0.34.2.
4 4 # The point is for the user to remove these configuration records
5 5 # one by one as the offenses are removed from the code base.
6 6 # Note that changes in the inspected code, or installation of new
... ... @@ -13,13 +13,13 @@ Metrics/AbcSize:
13 13 # Offense count: 5
14 14 # Configuration parameters: CountComments.
15 15 Metrics/ClassLength:
16   - Max: 203
  16 + Max: 205
17 17  
18 18 # Offense count: 5
19 19 Metrics/CyclomaticComplexity:
20 20 Max: 11
21 21  
22   -# Offense count: 458
  22 +# Offense count: 457
23 23 # Configuration parameters: AllowURI, URISchemes.
24 24 Metrics/LineLength:
25 25 Max: 239
... ... @@ -64,7 +64,7 @@ Style/AlignHash:
64 64 - 'spec/controllers/problems_controller_spec.rb'
65 65 - 'spec/models/problem_spec.rb'
66 66  
67   -# Offense count: 7
  67 +# Offense count: 6
68 68 # Cop supports --auto-correct.
69 69 # Configuration parameters: EnforcedStyle, SupportedStyles.
70 70 Style/AlignParameters:
... ... @@ -72,7 +72,6 @@ Style/AlignParameters:
72 72 - 'app/helpers/apps_helper.rb'
73 73 - 'app/models/app.rb'
74 74 - 'app/models/notification_services/gtalk_service.rb'
75   - - 'app/models/problem.rb'
76 75 - 'config/initializers/devise.rb'
77 76  
78 77 # Offense count: 105
... ... @@ -146,14 +145,6 @@ Style/Documentation:
146 145 Style/DotPosition:
147 146 Enabled: false
148 147  
149   -# Offense count: 6
150   -Style/DoubleNegation:
151   - Exclude:
152   - - 'Gemfile'
153   - - 'app/controllers/apps_controller.rb'
154   - - 'app/helpers/apps_helper.rb'
155   - - 'app/models/app.rb'
156   -
157 148 # Offense count: 5
158 149 Style/EachWithObject:
159 150 Exclude:
... ...
Gemfile
... ... @@ -100,7 +100,7 @@ group :test do
100 100 end
101 101  
102 102 group :heroku, :production do
103   - gem 'rails_12factor', require: !!ENV["HEROKU"]
  103 + gem 'rails_12factor', require: ENV.key?("HEROKU")
104 104 gem 'unicorn', require: false, platform: 'ruby'
105 105 end
106 106  
... ...
app/controllers/apps_controller.rb
... ... @@ -20,7 +20,7 @@ class AppsController < ApplicationController
20 20 end
21 21  
22 22 expose(:all_errs) {
23   - !!params[:all_errs]
  23 + params[:all_errs].present?
24 24 }
25 25  
26 26 expose(:problems) {
... ...
app/helpers/apps_helper.rb
... ... @@ -45,7 +45,7 @@ module AppsHelper
45 45 @any_github_repos ||= app.github_repo?
46 46 @any_bitbucket_repos ||= app.bitbucket_repo?
47 47 @any_issue_trackers ||= app.issue_tracker_configured?
48   - @any_deploys ||= !!app.last_deploy_at
  48 + @any_deploys ||= app.last_deploy_at.present?
49 49 @any_notification_services ||= app.notification_service_configured?
50 50 end
51 51 end
... ...
app/models/app.rb
... ... @@ -135,11 +135,12 @@ class App
135 135  
136 136  
137 137 def issue_tracker_configured?
138   - !!issue_tracker && !!(issue_tracker.configured?)
  138 + issue_tracker.present? && issue_tracker.configured?
139 139 end
140 140  
141 141 def notification_service_configured?
142   - !!(notification_service.class < NotificationService && notification_service.configured?)
  142 + (notification_service.class < NotificationService) &&
  143 + notification_service.configured?
143 144 end
144 145  
145 146  
... ...