From adc7694d13ea9b700f316eb1af983800ffcd9691 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2020 14:11:21 -0400 Subject: [PATCH 1/2] Bump rubocop from 0.88.0 to 0.89.0 (#543) * Bump rubocop from 0.88.0 to 0.89.0 Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.88.0 to 0.89.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.88.0...v0.89.0) Signed-off-by: dependabot-preview[bot] * Follow new rubocop guidelines Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Camden Moors --- Gemfile.lock | 6 +++--- app/controllers/user_requests_controller.rb | 2 ++ app/helpers/application_helper.rb | 2 +- app/helpers/teams_helper.rb | 4 ++-- app/models/team.rb | 5 ++--- config/environments/production.rb | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 70d8e537..e3ecc0ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -290,7 +290,7 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.4) - rubocop (0.88.0) + rubocop (0.89.0) parallel (~> 1.10) parser (>= 2.7.1.1) rainbow (>= 2.2.2, < 4.0) @@ -299,8 +299,8 @@ GEM rubocop-ast (>= 0.1.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.2.0) - parser (>= 2.7.0.1) + rubocop-ast (0.3.0) + parser (>= 2.7.1.4) rubocop-rails (2.7.1) activesupport (>= 4.2.0) rack (>= 1.1) diff --git a/app/controllers/user_requests_controller.rb b/app/controllers/user_requests_controller.rb index ee3a44ec..daf1d61d 100644 --- a/app/controllers/user_requests_controller.rb +++ b/app/controllers/user_requests_controller.rb @@ -48,12 +48,14 @@ def destroy # accept the users request. # Reducing the Cyclomatic Complexity on this severely reduces the readability of this function # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity def captain_of_team_requested @user_request = current_user&.team&.user_requests&.find(params[:id]) @team = @user_request&.team raise ActiveRecord::RecordNotFound unless @user_request&.team&.team_captain&.eql?(current_user) end # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity # Only allow team captain and the user requesting to delete a user request. def check_if_able_to_reject diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 498d92ee..c8080132 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -28,6 +28,6 @@ def active_navbar?(page) end def amount_of_errors(alerts) - pluralize(alerts.length, I18n.t('challenges.error_singular')) + ':' + "#{pluralize(alerts.length, I18n.t('challenges.error_singular'))}:" end end diff --git a/app/helpers/teams_helper.rb b/app/helpers/teams_helper.rb index 6c9bd705..ed767905 100644 --- a/app/helpers/teams_helper.rb +++ b/app/helpers/teams_helper.rb @@ -4,7 +4,7 @@ module TeamsHelper def display_name(team) return team.team_name if team.eligible? - "#{team.team_name} (" + I18n.t('challenges.team_ineligible_for_prizes') + ')' + "#{team.team_name} (#{I18n.t('challenges.team_ineligible_for_prizes')})" end def solved_challenge_table_point_value(solved_challenge, team) @@ -22,6 +22,6 @@ def eligible?(user_request) end def header_with_points(team) - "#{display_name(team)} - " + pluralize(team.score, I18n.t('challenges.point_value_singular')) + "#{display_name(team)} - #{pluralize(team.score, I18n.t('challenges.point_value_singular'))}" end end diff --git a/app/models/team.rb b/app/models/team.rb index e006fb7f..e7fed599 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -89,14 +89,14 @@ def find_rank (1 + (division.ordered_teams.index self)) end - # rubocop:disable Metrics/AbcSize # Takes a query and the column it is filtering and returns results. def self.search_by(query, column_to_filter) # condition query, parse into individual keywords terms = query.to_s.downcase.split(/\s+/) # replace "*" with "%" for wildcard searches, # prepend and append '%', remove duplicate '%'s - terms = terms.map { |e| ('%' + e.tr('*', '%') + '%').gsub(/%+/, '%') } + # string concatenation here works much better than interpolation + terms = terms.map { |e| ('%' + e.tr('*', '%') + '%').gsub(/%+/, '%') } # rubocop:disable Style/StringConcatenation # configure number of OR conditions for provision # of interpolation arguments. Adjust this if you # change the number of OR conditions. @@ -109,7 +109,6 @@ def self.search_by(query, column_to_filter) *terms.map { |e| [e] * num_or_conditions }.flatten ) end - # rubocop:enable Metrics/AbcSize def cleanup destroy if users.empty? diff --git a/config/environments/production.rb b/config/environments/production.rb index a3697c7f..6b519149 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -83,7 +83,7 @@ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV['RAILS_LOG_TO_STDOUT'].present? - logger = ActiveSupport::Logger.new(STDOUT) + logger = ActiveSupport::Logger.new($stdout) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end From 5a06b6b84804e750a5e1d035ec4d1524f59e9837 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2020 10:12:48 +0000 Subject: [PATCH 2/2] Bump rubocop from 0.89.0 to 0.89.1 Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.89.0 to 0.89.1. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.89.0...v0.89.1) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e3ecc0ef..31fd9db9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -290,13 +290,13 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.4) - rubocop (0.89.0) + rubocop (0.89.1) parallel (~> 1.10) parser (>= 2.7.1.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.7) rexml - rubocop-ast (>= 0.1.0, < 1.0) + rubocop-ast (>= 0.3.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) rubocop-ast (0.3.0)