summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-07-02 13:57:38 +0000
committerLin Jen-Shin <godfat@godfat.org>2018-07-09 21:13:08 +0800
commit9286f5b9340f92131c320c231a5fb3e51c23bf04 (patch)
tree49bbb5c1ebc03a9fda46791273e949a8e467710f
parent4ee08b77bc5ae11553d59c182ea8292b77699115 (diff)
downloadgitlab-ce-9286f5b9340f92131c320c231a5fb3e51c23bf04.tar.gz
Use stable gitlab-styles and eliminate offenses
-rw-r--r--.rubocop.yml6
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock16
-rw-r--r--Gemfile.rails5.lock16
-rw-r--r--app/controllers/projects/wikis_controller.rb2
-rw-r--r--app/models/wiki_page.rb5
-rw-r--r--app/services/notification_recipient_service.rb1
-rw-r--r--app/services/projects/lfs_pointers/lfs_download_service.rb2
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--lib/gitlab/metrics/influx_db.rb1
-rw-r--r--spec/features/projects/files/user_browses_files_spec.rb1
-rw-r--r--spec/helpers/blob_helper_spec.rb4
-rw-r--r--spec/lib/gitlab/sanitizers/svg_spec.rb4
-rw-r--r--spec/lib/gitlab/workhorse_spec.rb2
14 files changed, 29 insertions, 35 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 0582bfe8d70..d0584b46b06 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -31,6 +31,12 @@ Style/MutableConstant:
- 'ee/db/post_migrate/**/*'
- 'ee/db/geo/migrate/**/*'
+Naming/UncommunicativeMethodParamName:
+ Enabled: false
+
+Naming/MemoizedInstanceVariableName:
+ Enabled: false
+
Naming/FileName:
ExpectMatchingDefinition: true
Exclude:
diff --git a/Gemfile b/Gemfile
index e52627dbadd..b83bdeb15e5 100644
--- a/Gemfile
+++ b/Gemfile
@@ -351,7 +351,7 @@ group :development, :test do
gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4'
- gem 'gitlab-styles', '~> 2.4', require: false, git: 'https://gitlab.com/gitlab-org/gitlab-styles.git', branch: 'update-to-0.54.0'
+ gem 'gitlab-styles', '~> 2.4', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines
gem 'rubocop', '~> 0.54.0'
gem 'rubocop-rspec', '~> 1.22.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 41d22f3ec89..ad0675ddb8f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,13 +1,3 @@
-GIT
- remote: https://gitlab.com/gitlab-org/gitlab-styles.git
- revision: f3250343d3a13a154fe9b2d356440654297b0624
- branch: update-to-0.54.0
- specs:
- gitlab-styles (2.4.0)
- rubocop (~> 0.54.0)
- rubocop-gitlab-security (~> 0.1.0)
- rubocop-rspec (~> 1.19)
-
GEM
remote: https://rubygems.org/
specs:
@@ -322,6 +312,10 @@ GEM
mime-types (>= 1.16)
posix-spawn (~> 0.3)
gitlab-markup (1.6.4)
+ gitlab-styles (2.4.0)
+ rubocop (~> 0.54.0)
+ rubocop-gitlab-security (~> 0.1.0)
+ rubocop-rspec (~> 1.19)
gitlab_omniauth-ldap (2.0.4)
net-ldap (~> 0.16)
omniauth (~> 1.3)
@@ -1049,7 +1043,7 @@ DEPENDENCIES
gitlab-gollum-lib (~> 4.2)
gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-markup (~> 1.6.4)
- gitlab-styles (~> 2.4)!
+ gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2)
google-api-client (~> 0.19.8)
diff --git a/Gemfile.rails5.lock b/Gemfile.rails5.lock
index b74cbf41343..e167bbcb52e 100644
--- a/Gemfile.rails5.lock
+++ b/Gemfile.rails5.lock
@@ -1,13 +1,3 @@
-GIT
- remote: https://gitlab.com/gitlab-org/gitlab-styles.git
- revision: f3250343d3a13a154fe9b2d356440654297b0624
- branch: update-to-0.54.0
- specs:
- gitlab-styles (2.4.0)
- rubocop (~> 0.54.0)
- rubocop-gitlab-security (~> 0.1.0)
- rubocop-rspec (~> 1.19)
-
GEM
remote: https://rubygems.org/
specs:
@@ -325,6 +315,10 @@ GEM
mime-types (>= 1.16)
posix-spawn (~> 0.3)
gitlab-markup (1.6.4)
+ gitlab-styles (2.4.0)
+ rubocop (~> 0.54.0)
+ rubocop-gitlab-security (~> 0.1.0)
+ rubocop-rspec (~> 1.19)
gitlab_omniauth-ldap (2.0.4)
net-ldap (~> 0.16)
omniauth (~> 1.3)
@@ -1059,7 +1053,7 @@ DEPENDENCIES
gitlab-gollum-lib (~> 4.2)
gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-markup (~> 1.6.4)
- gitlab-styles (~> 2.4)!
+ gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2)
google-api-client (~> 0.19.8)
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 658b6ee5820..c01066c688a 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -129,7 +129,7 @@ class Projects::WikisController < Projects::ApplicationController
def build_page(args)
WikiPage.new(@project_wiki).tap do |page|
- page.update(args)
+ page.update_attributes(args) # rubocop:disable Rails/ActiveRecordAliases
end
end
end
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 6cd3993a56d..4b49edb01a5 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/ActiveRecordAliases
class WikiPage
PageChangedError = Class.new(StandardError)
PageRenameError = Class.new(StandardError)
@@ -190,7 +191,7 @@ class WikiPage
# Returns the String SHA1 of the newly created page
# or False if the save was unsuccessful.
def create(attrs = {})
- update(attrs)
+ update_attributes(attrs)
save(page_details: title) do
wiki.create_page(title, content, format, message)
@@ -216,7 +217,7 @@ class WikiPage
raise PageChangedError
end
- update(attrs)
+ update_attributes(attrs)
if title_changed?
page_details = title
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index d3447aa9951..628215b55fa 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -43,6 +43,7 @@ module NotificationRecipientService
def target
raise 'abstract'
end
+
def project
target.project
end
diff --git a/app/services/projects/lfs_pointers/lfs_download_service.rb b/app/services/projects/lfs_pointers/lfs_download_service.rb
index 6ea43561d61..618c30b971f 100644
--- a/app/services/projects/lfs_pointers/lfs_download_service.rb
+++ b/app/services/projects/lfs_pointers/lfs_download_service.rb
@@ -22,7 +22,7 @@ module Projects
private
def download_and_save_file(file, sanitized_uri)
- IO.copy_stream(open(sanitized_uri.sanitized_url, headers(sanitized_uri)), file)
+ IO.copy_stream(open(sanitized_uri.sanitized_url, headers(sanitized_uri)), file) # rubocop:disable Security/Open
end
def headers(sanitized_uri)
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 324eac038e1..ef29a871be0 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1068,6 +1068,7 @@ module Gitlab
true
end
+
def multi_action(
user, branch_name:, message:, actions:,
author_email: nil, author_name: nil,
@@ -1079,7 +1080,6 @@ module Gitlab
start_branch_name, start_repository)
end
end
- # rubocop:enable Metrics/ParameterLists
def write_config(full_path:)
return unless full_path.present?
diff --git a/lib/gitlab/metrics/influx_db.rb b/lib/gitlab/metrics/influx_db.rb
index 93cd6580d9a..04135dac4ff 100644
--- a/lib/gitlab/metrics/influx_db.rb
+++ b/lib/gitlab/metrics/influx_db.rb
@@ -162,7 +162,6 @@ module Gitlab
# When enabled this should be set before being used as the usual pattern
# "@foo ||= bar" is _not_ thread-safe.
- # rubocop:disable Gitlab/ModuleWithInstanceVariables
def pool
if influx_metrics_enabled?
if @pool.nil?
diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb
index 9b1395d5e0a..f56174fc85c 100644
--- a/spec/features/projects/files/user_browses_files_spec.rb
+++ b/spec/features/projects/files/user_browses_files_spec.rb
@@ -149,7 +149,6 @@ describe "User browses files" do
end
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`.
find("a", text: /^empty$/)["href"] == project_blob_url(project, "markdown/d/README.md")
- # rubocop:enable Lint/Void
end
it "shows correct content of directory" do
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb
index a3e010c3206..1c216b3fe97 100644
--- a/spec/helpers/blob_helper_spec.rb
+++ b/spec/helpers/blob_helper_spec.rb
@@ -65,9 +65,9 @@ describe BlobHelper do
describe "#sanitize_svg_data" do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') }
- let(:data) { open(input_svg_path).read }
+ let(:data) { File.read(input_svg_path) }
let(:expected_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') }
- let(:expected) { open(expected_svg_path).read }
+ let(:expected) { File.read(expected_svg_path) }
it 'retains essential elements' do
expect(sanitize_svg_data(data)).to eq(expected)
diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb
index 030c2063ab2..df46a874528 100644
--- a/spec/lib/gitlab/sanitizers/svg_spec.rb
+++ b/spec/lib/gitlab/sanitizers/svg_spec.rb
@@ -7,9 +7,9 @@ describe Gitlab::Sanitizers::SVG do
describe '.clean' do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') }
- let(:data) { open(input_svg_path).read }
+ let(:data) { File.read(input_svg_path) }
let(:sanitized_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') }
- let(:sanitized) { open(sanitized_svg_path).read }
+ let(:sanitized) { File.read(sanitized_svg_path) }
it 'delegates sanitization to scrubber' do
expect_any_instance_of(Gitlab::Sanitizers::SVG::Scrubber).to receive(:scrub).at_least(:once)
diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb
index 8fdcfe79fb5..7802ff1f5f6 100644
--- a/spec/lib/gitlab/workhorse_spec.rb
+++ b/spec/lib/gitlab/workhorse_spec.rb
@@ -177,7 +177,7 @@ describe Gitlab::Workhorse do
end
it 'accepts a trailing newline' do
- open(described_class.secret_path, 'a') { |f| f.write "\n" }
+ File.open(described_class.secret_path, 'a') { |f| f.write "\n" }
expect(subject.length).to eq(32)
end