Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-04-30 08:11:41 +0300
committerStan Hu <stanhu@gmail.com>2019-05-01 18:04:33 +0300
commitd79664c66b657367e239be6236d359b8b7ed2403 (patch)
tree97029302f2aac2747ed9185aaf251fafc042d367
parentb6d99f479da84bc4814ffaf573f28e95d7e5d488 (diff)
Upgrade Rubocop to 0.68.1
Correct and exempt some cop failures. This is needed to support Ruby 2.6.
-rw-r--r--changelogs/unreleased/sh-upgrade-rubocop.yml5
-rw-r--r--ruby/.rubocop.yml4
-rw-r--r--ruby/Gemfile2
-rw-r--r--ruby/Gemfile.lock16
-rw-r--r--ruby/lib/gitaly_server/repository_service.rb10
-rw-r--r--ruby/lib/gitaly_server/utils.rb2
-rw-r--r--ruby/lib/gitlab/git.rb2
-rw-r--r--ruby/lib/gitlab/git/gitaly_remote_repository.rb2
-rw-r--r--ruby/lib/gitlab/git/operation_service.rb13
-rw-r--r--ruby/lib/gitlab/git/repository.rb9
10 files changed, 34 insertions, 31 deletions
diff --git a/changelogs/unreleased/sh-upgrade-rubocop.yml b/changelogs/unreleased/sh-upgrade-rubocop.yml
new file mode 100644
index 000000000..96fbfc9a4
--- /dev/null
+++ b/changelogs/unreleased/sh-upgrade-rubocop.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade Rubocop to 0.68.1
+merge_request: 1229
+author:
+type: other
diff --git a/ruby/.rubocop.yml b/ruby/.rubocop.yml
index 53b654cc3..4408434bf 100644
--- a/ruby/.rubocop.yml
+++ b/ruby/.rubocop.yml
@@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml
AllCops:
+ TargetRubyVersion: 2.5
Exclude:
- 'tmp/**/*'
- 'vendor/**/*'
@@ -12,3 +13,6 @@ Style/NumericPredicate:
Style/RedundantBegin:
Enabled: false
+
+Naming/RescuedExceptionsVariableName:
+ Enabled: false
diff --git a/ruby/Gemfile b/ruby/Gemfile
index 7e2473502..8331b74ee 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.50', require: false
+ gem 'rubocop', '~> 0.68', 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 280d3c808..83bf0a938 100644
--- a/ruby/Gemfile.lock
+++ b/ruby/Gemfile.lock
@@ -73,6 +73,7 @@ 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)
@@ -93,11 +94,10 @@ GEM
nokogumbo (1.5.0)
nokogiri
optimist (3.0.0)
- parallel (1.12.1)
+ parallel (1.17.0)
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.54.0)
+ rubocop (0.68.1)
+ jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
- parser (>= 2.5)
- powerpack (~> 0.1)
+ parser (>= 2.5, != 2.5.1.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (~> 1.0, >= 1.0.1)
+ unicode-display_width (>= 1.4.0, < 1.6)
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.4.0)
+ unicode-display_width (1.5.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.50)
+ rubocop (~> 0.68)
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 e3d84bf57..d01ac7e96 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 9748522bc..e81e148e2 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
+ URL_HOST_PATTERN = %r{([a-z][a-z0-9+\-.]*://)?([a-z0-9\-._~%!$&'()*+,;=:]+@)([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&'()*+,;=:]+\])}i.freeze
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 09b6e8b37..3688b2be5 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).freeze
+ BLANK_SHA = '0' * 40
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 6fa6657d0..237ca5472 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
+ PEM_REXP = /[-]+BEGIN CERTIFICATE[-]+.+?[-]+END CERTIFICATE[-]+/m.freeze
attr_reader :gitaly_client
diff --git a/ruby/lib/gitlab/git/operation_service.rb b/ruby/lib/gitlab/git/operation_service.rb
index 74951ade0..2b3355c0d 100644
--- a/ruby/lib/gitlab/git/operation_service.rb
+++ b/ruby/lib/gitlab/git/operation_service.rb
@@ -73,14 +73,11 @@ 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 534ad8a99..73373a0a9 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -490,12 +490,9 @@ 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,