From 909d4928c7e670bd7143e014a18298ac343aa6f5 Mon Sep 17 00:00:00 2001 From: John Cai Date: Wed, 1 May 2019 16:04:20 -0700 Subject: Revert "Merge branch 'sh-upgrade-rubocop' into 'master'" This reverts commit 1e888f40a6f1525e6eca3c88b4539c87c9e10d6b, reversing changes made to 31248fb723a2b7a150eae552d14d9a68d10305b2. --- ruby/.rubocop.yml | 4 ---- ruby/Gemfile | 2 +- ruby/Gemfile.lock | 16 ++++++++-------- ruby/lib/gitaly_server/repository_service.rb | 10 +++++----- ruby/lib/gitaly_server/utils.rb | 2 +- ruby/lib/gitlab/git.rb | 2 +- ruby/lib/gitlab/git/gitaly_remote_repository.rb | 2 +- ruby/lib/gitlab/git/operation_service.rb | 13 ++++++++----- ruby/lib/gitlab/git/repository.rb | 9 ++++++--- 9 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ruby/.rubocop.yml b/ruby/.rubocop.yml index 4408434bf..53b654cc3 100644 --- a/ruby/.rubocop.yml +++ b/ruby/.rubocop.yml @@ -1,7 +1,6 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.5 Exclude: - 'tmp/**/*' - 'vendor/**/*' @@ -13,6 +12,3 @@ Style/NumericPredicate: Style/RedundantBegin: Enabled: false - -Naming/RescuedExceptionsVariableName: - Enabled: false diff --git a/ruby/Gemfile b/ruby/Gemfile index 8331b74ee..7e2473502 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -23,7 +23,7 @@ gem 'licensee', '~> 8.9.0' gem 'google-protobuf', '~> 3.7.1' group :development, :test do - gem 'rubocop', '~> 0.68', require: false + gem 'rubocop', '~> 0.50', require: false gem 'rspec', require: false gem 'rspec-parameterized', require: false gem 'timecop', require: false diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 83bf0a938..280d3c808 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -73,7 +73,6 @@ GEM i18n (1.6.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jaro_winkler (1.5.2) json (2.2.0) licensee (8.9.2) rugged (~> 0.24) @@ -94,10 +93,11 @@ GEM nokogumbo (1.5.0) nokogiri optimist (3.0.0) - parallel (1.17.0) + parallel (1.12.1) parser (2.5.3.0) ast (~> 2.4.0) posix-spawn (0.3.13) + powerpack (0.1.2) proc_to_ast (0.1.0) coderay parser @@ -133,13 +133,13 @@ GEM rspec (>= 2.13, < 4) unparser rspec-support (3.7.1) - rubocop (0.68.1) - jaro_winkler (~> 1.5.1) + rubocop (0.54.0) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) + parser (>= 2.5) + powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.6) + unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.10.0) rugged (0.28.1) safe_yaml (1.0.4) @@ -159,7 +159,7 @@ GEM timecop (0.9.1) tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.5.0) + unicode-display_width (1.4.0) unparser (0.2.8) abstract_type (~> 0.0.7) adamantium (~> 0.2.0) @@ -196,7 +196,7 @@ DEPENDENCIES rdoc (~> 4.2) rspec rspec-parameterized - rubocop (~> 0.68) + rubocop (~> 0.50) rugged (~> 0.28) sentry-raven (~> 2.9.0) simplecov (~> 0.9.0) diff --git a/ruby/lib/gitaly_server/repository_service.rb b/ruby/lib/gitaly_server/repository_service.rb index d01ac7e96..e3d84bf57 100644 --- a/ruby/lib/gitaly_server/repository_service.rb +++ b/ruby/lib/gitaly_server/repository_service.rb @@ -102,11 +102,11 @@ module GitalyServer private OPERATION_MAP = { - added: Gitaly::GetRawChangesResponse::RawChange::Operation::ADDED, - copied: Gitaly::GetRawChangesResponse::RawChange::Operation::COPIED, - deleted: Gitaly::GetRawChangesResponse::RawChange::Operation::DELETED, - modified: Gitaly::GetRawChangesResponse::RawChange::Operation::MODIFIED, - renamed: Gitaly::GetRawChangesResponse::RawChange::Operation::RENAMED, + added: Gitaly::GetRawChangesResponse::RawChange::Operation::ADDED, + copied: Gitaly::GetRawChangesResponse::RawChange::Operation::COPIED, + deleted: Gitaly::GetRawChangesResponse::RawChange::Operation::DELETED, + modified: Gitaly::GetRawChangesResponse::RawChange::Operation::MODIFIED, + renamed: Gitaly::GetRawChangesResponse::RawChange::Operation::RENAMED, type_changed: Gitaly::GetRawChangesResponse::RawChange::Operation::TYPE_CHANGED }.freeze diff --git a/ruby/lib/gitaly_server/utils.rb b/ruby/lib/gitaly_server/utils.rb index e81e148e2..9748522bc 100644 --- a/ruby/lib/gitaly_server/utils.rb +++ b/ruby/lib/gitaly_server/utils.rb @@ -1,7 +1,7 @@ module GitalyServer module Utils # See internal/logsanitizer/url.go for credits and explanation. - URL_HOST_PATTERN = %r{([a-z][a-z0-9+\-.]*://)?([a-z0-9\-._~%!$&'()*+,;=:]+@)([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&'()*+,;=:]+\])}i.freeze + URL_HOST_PATTERN = %r{([a-z][a-z0-9+\-.]*://)?([a-z0-9\-._~%!$&'()*+,;=:]+@)([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&'()*+,;=:]+\])}i def gitaly_commit_from_rugged(rugged_commit) message_split = rugged_commit.message.b.split("\n", 2) diff --git a/ruby/lib/gitlab/git.rb b/ruby/lib/gitlab/git.rb index 3688b2be5..09b6e8b37 100644 --- a/ruby/lib/gitlab/git.rb +++ b/ruby/lib/gitlab/git.rb @@ -45,7 +45,7 @@ module Gitlab # See http://stackoverflow.com/a/40884093/1856239 and # https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012 EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze - BLANK_SHA = '0' * 40 + BLANK_SHA = ('0' * 40).freeze TAG_REF_PREFIX = "refs/tags/".freeze BRANCH_REF_PREFIX = "refs/heads/".freeze diff --git a/ruby/lib/gitlab/git/gitaly_remote_repository.rb b/ruby/lib/gitlab/git/gitaly_remote_repository.rb index 237ca5472..6fa6657d0 100644 --- a/ruby/lib/gitlab/git/gitaly_remote_repository.rb +++ b/ruby/lib/gitlab/git/gitaly_remote_repository.rb @@ -2,7 +2,7 @@ module Gitlab module Git class GitalyRemoteRepository < RemoteRepository CLIENT_NAME = 'gitaly-ruby'.freeze - PEM_REXP = /[-]+BEGIN CERTIFICATE[-]+.+?[-]+END CERTIFICATE[-]+/m.freeze + PEM_REXP = /[-]+BEGIN CERTIFICATE[-]+.+?[-]+END CERTIFICATE[-]+/m attr_reader :gitaly_client diff --git a/ruby/lib/gitlab/git/operation_service.rb b/ruby/lib/gitlab/git/operation_service.rb index 2b3355c0d..74951ade0 100644 --- a/ruby/lib/gitlab/git/operation_service.rb +++ b/ruby/lib/gitlab/git/operation_service.rb @@ -73,11 +73,14 @@ module Gitlab # it would be created from `start_branch_name`. # If `start_repository` is passed, and the branch doesn't exist, # it would try to find the commits from it instead of current repository. - def with_branch(branch_name, - start_branch_name: nil, - start_repository: repository, - force: false, - &block) + def with_branch( + branch_name, + start_branch_name: nil, + start_repository: repository, + force: false, + &block + ) + Gitlab::Git.check_namespace!(start_repository) start_repository = RemoteRepository.new(start_repository) unless start_repository.is_a?(RemoteRepository) diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb index 73373a0a9..534ad8a99 100644 --- a/ruby/lib/gitlab/git/repository.rb +++ b/ruby/lib/gitlab/git/repository.rb @@ -490,9 +490,12 @@ module Gitlab end # rubocop:disable Metrics/ParameterLists - def multi_action(user, branch_name:, message:, actions:, - author_email: nil, author_name: nil, - start_branch_name: nil, start_repository: self, force: false) + def multi_action( + user, branch_name:, message:, actions:, + author_email: nil, author_name: nil, + start_branch_name: nil, start_repository: self, force: false + ) + OperationService.new(user, self).with_branch( branch_name, start_branch_name: start_branch_name, -- cgit v1.2.3