diff --git a/.rubocop.yml b/.rubocop.yml index 5366e0535..eeeea3dc4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -646,6 +646,10 @@ Style/SwapValues: StyleGuide: '#values-swapping' Enabled: true +Style/TopLevelMethodDefinition: + Description: 'This cop looks for top-level method definitions.' + Enabled: true + Style/TrailingCommaInArguments: Description: 'Checks for trailing comma in argument lists.' StyleGuide: '#no-trailing-params-comma' diff --git a/Gemfile b/Gemfile index c9b1ad029..d5178d2b1 100644 --- a/Gemfile +++ b/Gemfile @@ -147,7 +147,7 @@ group :development, :test do gem "knapsack_pro", "~> 2.16.0" # Help parallelize Ruby spec builds gem "pry-byebug", "~> 3.8" # Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish', 'continue' and 'break' commands to control execution gem "rspec-rails", "~> 5.0" # rspec-rails is a testing framework for Rails 3+ - gem "rubocop", "~> 1.14", require: false # Automatic Ruby code style checking tool + gem "rubocop", "~> 1.15", require: false # Automatic Ruby code style checking tool gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code gem "rubocop-rails", "~> 2.10", require: false # Automatic Rails code style checking tool gem "rubocop-rspec", "~> 2.3", require: false # Code style checking for RSpec files diff --git a/Gemfile.lock b/Gemfile.lock index 882d7f96e..86f7db116 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -650,7 +650,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.10.2) - rubocop (1.14.0) + rubocop (1.15.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -955,7 +955,7 @@ DEPENDENCIES rpush-redis (~> 1.1) rspec-rails (~> 5.0) rspec-retry (~> 0.6) - rubocop (~> 1.14) + rubocop (~> 1.15) rubocop-performance (~> 1.11) rubocop-rails (~> 2.10) rubocop-rspec (~> 2.3) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index fa061bd73..3d8e6bb8e 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -12,6 +12,8 @@ class RegistrationsController < Devise::RegistrationsController end end + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity def create not_authorized unless Settings::Authentication.allow_email_password_registration || SiteConfig.waiting_on_first_user @@ -45,6 +47,8 @@ class RegistrationsController < Devise::RegistrationsController flash[:notice] = "You must complete the recaptcha ✅" end end + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity private diff --git a/app/workers/github_repos/repo_sync_worker.rb b/app/workers/github_repos/repo_sync_worker.rb index 8ff87b789..e5efc15e9 100644 --- a/app/workers/github_repos/repo_sync_worker.rb +++ b/app/workers/github_repos/repo_sync_worker.rb @@ -38,11 +38,9 @@ module GithubRepos Github::Errors::RepositoryUnavailable repo.destroy rescue Github::Errors::ClientError => e - if e.message.include? "Repository access blocked" - repo.destroy - else - raise e - end + raise e unless e.message.include?("Repository access blocked") + + repo.destroy end end end diff --git a/vendor/cache/rubocop-1.14.0.gem b/vendor/cache/rubocop-1.14.0.gem deleted file mode 100644 index 4beaa6e89..000000000 Binary files a/vendor/cache/rubocop-1.14.0.gem and /dev/null differ diff --git a/vendor/cache/rubocop-1.15.0.gem b/vendor/cache/rubocop-1.15.0.gem new file mode 100644 index 000000000..2bbe16518 Binary files /dev/null and b/vendor/cache/rubocop-1.15.0.gem differ