Commit 432e02fbf22873bcf99654ed99d192e35e789bb1

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

Rubocop: manually fixing linter warnings: assignment in condition

app/controllers/api/v1/stats_controller.rb
... ... @@ -6,7 +6,7 @@ class Api::V1::StatsController < ApplicationController
6 6 before_action :require_api_key_or_authenticate_user!
7 7  
8 8 def app
9   - if problem = @app.problems.order_by(:last_notice_at.desc).first
  9 + if (problem = @app.problems.order_by(:last_notice_at.desc).first)
10 10 @last_error_time = problem.last_notice_at
11 11 end
12 12  
... ... @@ -28,7 +28,7 @@ class Api::V1::StatsController < ApplicationController
28 28  
29 29 def require_api_key_or_authenticate_user!
30 30 if params[:api_key].present?
31   - if @app = App.where(:api_key => params[:api_key]).first
  31 + if (@app = App.where(:api_key => params[:api_key]).first)
32 32 return true
33 33 end
34 34 end
... ...
app/controllers/apps_controller.rb
... ... @@ -94,7 +94,7 @@ class AppsController < ApplicationController
94 94  
95 95 def initialize_subclassed_notification_service
96 96 # set the app's notification service
97   - if params[:app][:notification_service_attributes] && notification_type = params[:app][:notification_service_attributes][:type]
  97 + if params[:app][:notification_service_attributes] && (notification_type = params[:app][:notification_service_attributes][:type])
98 98 available_notification_classes = [NotificationService] + NotificationService.subclasses
99 99 notification_class = available_notification_classes.detect{|c| c.name == notification_type}
100 100 if !notification_class.nil?
... ... @@ -112,7 +112,7 @@ class AppsController < ApplicationController
112 112  
113 113 # email_at_notices is edited as a string, and stored as an array.
114 114 def parse_email_at_notices_or_set_default
115   - if params[:app] && val = params[:app][:email_at_notices]
  115 + if params[:app] && (val = params[:app][:email_at_notices])
116 116 # Sanitize negative values, split on comma,
117 117 # strip, parse as integer, remove all '0's.
118 118 # If empty, set as default and show an error message.
... ... @@ -127,7 +127,7 @@ class AppsController < ApplicationController
127 127 end
128 128  
129 129 def parse_notice_at_notices_or_set_default
130   - if params[:app][:notification_service_attributes] && val = params[:app][:notification_service_attributes][:notify_at_notices]
  130 + if params[:app][:notification_service_attributes] && (val = params[:app][:notification_service_attributes][:notify_at_notices])
131 131 # Sanitize negative values, split on comma,
132 132 # strip, parse as integer, remove all '0's.
133 133 # If empty, set as default and show an error message.
... ...
app/controllers/users/omniauth_callbacks_controller.rb
... ... @@ -5,7 +5,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
5 5 github_user = User.where(:github_login => github_login).first
6 6 github_site_title = Errbit::Config.github_site_title
7 7  
8   - if github_user.nil? && github_org_id = Errbit::Config.github_org_id
  8 + if github_user.nil? && (github_org_id = Errbit::Config.github_org_id)
9 9 # See if they are a member of the organization that we have access for
10 10 # If they are, automatically create an account
11 11 client = Octokit::Client.new(access_token: github_token)
... ...
app/models/app.rb
... ... @@ -153,14 +153,14 @@ class App
153 153  
154 154 # Copy app attributes from another app.
155 155 def copy_attributes_from(app_id)
156   - if copy_app = App.where(:_id => app_id).first
  156 + if (copy_app = App.where(:_id => app_id).first)
157 157 # Copy fields
158 158 (copy_app.fields.keys - %w(_id name created_at updated_at)).each do |k|
159 159 self.send("#{k}=", copy_app.send(k))
160 160 end
161 161 # Clone the embedded objects that can be changed via apps/edit (ignore errs & deploys, etc.)
162 162 %w(watchers issue_tracker notification_service).each do |relation|
163   - if obj = copy_app.send(relation)
  163 + if (obj = copy_app.send(relation))
164 164 self.send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone)
165 165 end
166 166 end
... ...
app/models/notice.rb
... ... @@ -82,7 +82,7 @@ class Notice
82 82 def to_curl
83 83 return "N/A" if url.blank?
84 84 headers = %w(Accept Accept-Encoding Accept-Language Cookie Referer User-Agent).each_with_object([]) do |name, h|
85   - if value = env_vars["HTTP_#{name.underscore.upcase}"]
  85 + if (value = env_vars["HTTP_#{name.underscore.upcase}"])
86 86 h << "-H '#{name}: #{value}'"
87 87 end
88 88 end
... ...