Skip to content

Commit 27c3c4a

Browse files
committed
Make rubocop happy
1 parent 203a1c2 commit 27c3c4a

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

app/controllers/plans_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def render_phases_edit(plan, phase, guidance_groups)
524524
readonly = !plan.editable_by?(current_user.id)
525525
# Since the answers have been pre-fetched through plan (see Plan.load_for_phase)
526526
# we create a hash whose keys are question id and value is the answer associated
527-
answers = plan.answers.each_with_object({}) { |a, m| m[a.question_id] = a; }
527+
answers = plan.answers.each_with_object({}) { |a, m| m[a.question_id] = a }
528528
render('/phases/edit', locals: {
529529
base_template_org: phase.template.base_org,
530530
plan: plan,

app/models/contributor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def name_or_email_presence
135135
_("can't be blank."))
136136
end
137137

138-
if name.blank? && email.blank? && errors.size.zero?
138+
if name.blank? && email.blank? && errors.empty?
139139
errors.add(:name, _("can't be blank if no email is provided."))
140140
errors.add(:email, _("can't be blank if no name is provided."))
141141
end
142142

143-
errors.size.zero?
143+
errors.empty?
144144
end
145145
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
146146
end

app/models/plan.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def latest_update
441441
def owner
442442
r = roles.select { |rr| rr.active && rr.administrator }
443443
.min { |a, b| a.created_at <=> b.created_at }
444-
r.nil? ? nil : r.user
444+
r&.user
445445
end
446446

447447
# Creates a role for the specified user (will update the user's

app/services/external_apis/ror_service.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def query_string(term:, page: 1, filters: [])
105105
end
106106

107107
# Recursive method that can handle multiple ROR result pages if necessary
108-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
108+
# rubocop:disable Metrics/AbcSize
109109
def process_pages(term:, json:, filters: [])
110110
return [] if json.blank?
111111

@@ -117,7 +117,7 @@ def process_pages(term:, json:, filters: [])
117117
return results unless pages > 1
118118

119119
# Gather the results from the additional page (only up to the max)
120-
(2..(pages > max_pages ? max_pages : pages)).each do |page|
120+
(2..([pages, max_pages].min)).each do |page|
121121
json = query_ror(term: term, page: page, filters: filters)
122122
results += parse_results(json: json)
123123
end
@@ -129,7 +129,7 @@ def process_pages(term:, json:, filters: [])
129129
log_error(method: 'ROR search', error: e)
130130
results || []
131131
end
132-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
132+
# rubocop:enable Metrics/AbcSize
133133

134134
# Convert the JSON items into a hash
135135
# rubocop:disable Metrics/AbcSize

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
config.active_support.disallowed_deprecation_warnings = []
8888

8989
# Use default logging formatter so that PID and timestamp are not suppressed.
90-
config.log_formatter = ::Logger::Formatter.new
90+
config.log_formatter = Logger::Formatter.new
9191

9292
# Use a different logger for distributed setups.
9393
# require 'syslog/logger'

spec/support/capybara.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# https://docs.travis-ci.com/user/chrome#sandboxing
1818
Capybara.register_driver :selenium_chrome_headless do |app|
1919
Capybara::Selenium::Driver.load_selenium
20-
browser_options = ::Selenium::WebDriver::Chrome::Options.new
20+
browser_options = Selenium::WebDriver::Chrome::Options.new
2121
browser_options.args << '--headless'
2222
browser_options.args << '--no-sandbox'
2323
browser_options.args << '--disable-gpu' if Gem.win_platform?

0 commit comments

Comments
 (0)