Commit 9286f5b9 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use stable gitlab-styles and eliminate offenses

parent 4ee08b77
...@@ -31,6 +31,12 @@ Style/MutableConstant: ...@@ -31,6 +31,12 @@ Style/MutableConstant:
- 'ee/db/post_migrate/**/*' - 'ee/db/post_migrate/**/*'
- 'ee/db/geo/migrate/**/*' - 'ee/db/geo/migrate/**/*'
Naming/UncommunicativeMethodParamName:
Enabled: false
Naming/MemoizedInstanceVariableName:
Enabled: false
Naming/FileName: Naming/FileName:
ExpectMatchingDefinition: true ExpectMatchingDefinition: true
Exclude: Exclude:
......
...@@ -351,7 +351,7 @@ group :development, :test do ...@@ -351,7 +351,7 @@ group :development, :test do
gem 'spring', '~> 2.0.0' gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4' 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 # Pin these dependencies, otherwise a new rule could break the CI pipelines
gem 'rubocop', '~> 0.54.0' gem 'rubocop', '~> 0.54.0'
gem 'rubocop-rspec', '~> 1.22.1' gem 'rubocop-rspec', '~> 1.22.1'
......
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 GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -322,6 +312,10 @@ GEM ...@@ -322,6 +312,10 @@ GEM
mime-types (>= 1.16) mime-types (>= 1.16)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-markup (1.6.4) 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) gitlab_omniauth-ldap (2.0.4)
net-ldap (~> 0.16) net-ldap (~> 0.16)
omniauth (~> 1.3) omniauth (~> 1.3)
...@@ -1049,7 +1043,7 @@ DEPENDENCIES ...@@ -1049,7 +1043,7 @@ DEPENDENCIES
gitlab-gollum-lib (~> 4.2) gitlab-gollum-lib (~> 4.2)
gitlab-gollum-rugged_adapter (~> 0.4.4) gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-markup (~> 1.6.4) gitlab-markup (~> 1.6.4)
gitlab-styles (~> 2.4)! gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4) gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2) gon (~> 6.2)
google-api-client (~> 0.19.8) google-api-client (~> 0.19.8)
......
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 GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -325,6 +315,10 @@ GEM ...@@ -325,6 +315,10 @@ GEM
mime-types (>= 1.16) mime-types (>= 1.16)
posix-spawn (~> 0.3) posix-spawn (~> 0.3)
gitlab-markup (1.6.4) 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) gitlab_omniauth-ldap (2.0.4)
net-ldap (~> 0.16) net-ldap (~> 0.16)
omniauth (~> 1.3) omniauth (~> 1.3)
...@@ -1059,7 +1053,7 @@ DEPENDENCIES ...@@ -1059,7 +1053,7 @@ DEPENDENCIES
gitlab-gollum-lib (~> 4.2) gitlab-gollum-lib (~> 4.2)
gitlab-gollum-rugged_adapter (~> 0.4.4) gitlab-gollum-rugged_adapter (~> 0.4.4)
gitlab-markup (~> 1.6.4) gitlab-markup (~> 1.6.4)
gitlab-styles (~> 2.4)! gitlab-styles (~> 2.4)
gitlab_omniauth-ldap (~> 2.0.4) gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.2) gon (~> 6.2)
google-api-client (~> 0.19.8) google-api-client (~> 0.19.8)
......
...@@ -129,7 +129,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -129,7 +129,7 @@ class Projects::WikisController < Projects::ApplicationController
def build_page(args) def build_page(args)
WikiPage.new(@project_wiki).tap do |page| WikiPage.new(@project_wiki).tap do |page|
page.update(args) page.update_attributes(args) # rubocop:disable Rails/ActiveRecordAliases
end end
end end
end end
# rubocop:disable Rails/ActiveRecordAliases
class WikiPage class WikiPage
PageChangedError = Class.new(StandardError) PageChangedError = Class.new(StandardError)
PageRenameError = Class.new(StandardError) PageRenameError = Class.new(StandardError)
...@@ -190,7 +191,7 @@ class WikiPage ...@@ -190,7 +191,7 @@ class WikiPage
# Returns the String SHA1 of the newly created page # Returns the String SHA1 of the newly created page
# or False if the save was unsuccessful. # or False if the save was unsuccessful.
def create(attrs = {}) def create(attrs = {})
update(attrs) update_attributes(attrs)
save(page_details: title) do save(page_details: title) do
wiki.create_page(title, content, format, message) wiki.create_page(title, content, format, message)
...@@ -216,7 +217,7 @@ class WikiPage ...@@ -216,7 +217,7 @@ class WikiPage
raise PageChangedError raise PageChangedError
end end
update(attrs) update_attributes(attrs)
if title_changed? if title_changed?
page_details = title page_details = title
......
...@@ -43,6 +43,7 @@ module NotificationRecipientService ...@@ -43,6 +43,7 @@ module NotificationRecipientService
def target def target
raise 'abstract' raise 'abstract'
end end
def project def project
target.project target.project
end end
......
...@@ -22,7 +22,7 @@ module Projects ...@@ -22,7 +22,7 @@ module Projects
private private
def download_and_save_file(file, sanitized_uri) 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 end
def headers(sanitized_uri) def headers(sanitized_uri)
......
...@@ -1068,6 +1068,7 @@ module Gitlab ...@@ -1068,6 +1068,7 @@ module Gitlab
true true
end end
def multi_action( def multi_action(
user, branch_name:, message:, actions:, user, branch_name:, message:, actions:,
author_email: nil, author_name: nil, author_email: nil, author_name: nil,
...@@ -1079,7 +1080,6 @@ module Gitlab ...@@ -1079,7 +1080,6 @@ module Gitlab
start_branch_name, start_repository) start_branch_name, start_repository)
end end
end end
# rubocop:enable Metrics/ParameterLists
def write_config(full_path:) def write_config(full_path:)
return unless full_path.present? return unless full_path.present?
......
...@@ -162,7 +162,6 @@ module Gitlab ...@@ -162,7 +162,6 @@ module Gitlab
# When enabled this should be set before being used as the usual pattern # When enabled this should be set before being used as the usual pattern
# "@foo ||= bar" is _not_ thread-safe. # "@foo ||= bar" is _not_ thread-safe.
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def pool def pool
if influx_metrics_enabled? if influx_metrics_enabled?
if @pool.nil? if @pool.nil?
......
...@@ -149,7 +149,6 @@ describe "User browses files" do ...@@ -149,7 +149,6 @@ describe "User browses files" do
end end
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`. # 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") find("a", text: /^empty$/)["href"] == project_blob_url(project, "markdown/d/README.md")
# rubocop:enable Lint/Void
end end
it "shows correct content of directory" do it "shows correct content of directory" do
......
...@@ -65,9 +65,9 @@ describe BlobHelper do ...@@ -65,9 +65,9 @@ describe BlobHelper do
describe "#sanitize_svg_data" do describe "#sanitize_svg_data" do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') } 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_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 it 'retains essential elements' do
expect(sanitize_svg_data(data)).to eq(expected) expect(sanitize_svg_data(data)).to eq(expected)
......
...@@ -7,9 +7,9 @@ describe Gitlab::Sanitizers::SVG do ...@@ -7,9 +7,9 @@ describe Gitlab::Sanitizers::SVG do
describe '.clean' do describe '.clean' do
let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') } 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_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 it 'delegates sanitization to scrubber' do
expect_any_instance_of(Gitlab::Sanitizers::SVG::Scrubber).to receive(:scrub).at_least(:once) expect_any_instance_of(Gitlab::Sanitizers::SVG::Scrubber).to receive(:scrub).at_least(:once)
......
...@@ -177,7 +177,7 @@ describe Gitlab::Workhorse do ...@@ -177,7 +177,7 @@ describe Gitlab::Workhorse do
end end
it 'accepts a trailing newline' do 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) expect(subject.length).to eq(32)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment