Skip to content

Commit

Permalink
Make rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminfaure committed Feb 3, 2023
1 parent 203a1c2 commit 27c3c4a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def render_phases_edit(plan, phase, guidance_groups)
readonly = !plan.editable_by?(current_user.id)
# Since the answers have been pre-fetched through plan (see Plan.load_for_phase)
# we create a hash whose keys are question id and value is the answer associated
answers = plan.answers.each_with_object({}) { |a, m| m[a.question_id] = a; }
answers = plan.answers.each_with_object({}) { |a, m| m[a.question_id] = a }
render('/phases/edit', locals: {
base_template_org: phase.template.base_org,
plan: plan,
Expand Down
4 changes: 2 additions & 2 deletions app/models/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def name_or_email_presence
_("can't be blank."))
end

if name.blank? && email.blank? && errors.size.zero?
if name.blank? && email.blank? && errors.empty?
errors.add(:name, _("can't be blank if no email is provided."))
errors.add(:email, _("can't be blank if no name is provided."))
end

errors.size.zero?
errors.empty?
end
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
end
2 changes: 1 addition & 1 deletion app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def latest_update
def owner
r = roles.select { |rr| rr.active && rr.administrator }
.min { |a, b| a.created_at <=> b.created_at }
r.nil? ? nil : r.user
r&.user
end

# Creates a role for the specified user (will update the user's
Expand Down
6 changes: 3 additions & 3 deletions app/services/external_apis/ror_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def query_string(term:, page: 1, filters: [])
end

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

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

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

# Convert the JSON items into a hash
# rubocop:disable Metrics/AbcSize
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
config.active_support.disallowed_deprecation_warnings = []

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

# Use a different logger for distributed setups.
# require 'syslog/logger'
Expand Down
2 changes: 1 addition & 1 deletion spec/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# https://docs.travis-ci.com/user/chrome#sandboxing
Capybara.register_driver :selenium_chrome_headless do |app|
Capybara::Selenium::Driver.load_selenium
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options = Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--no-sandbox'
browser_options.args << '--disable-gpu' if Gem.win_platform?
Expand Down

0 comments on commit 27c3c4a

Please sign in to comment.