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