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