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:
- 'ee/db/post_migrate/**/*'
- 'ee/db/geo/migrate/**/*'
Naming/UncommunicativeMethodParamName:
Enabled: false
Naming/MemoizedInstanceVariableName:
Enabled: false
Naming/FileName:
ExpectMatchingDefinition: true
Exclude:
......
......@@ -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'
......
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)
......
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)
......
......@@ -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
# 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
......
......@@ -43,6 +43,7 @@ module NotificationRecipientService
def target
raise 'abstract'
end
def project
target.project
end
......
......@@ -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)
......
......@@ -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?
......
......@@ -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?
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
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