Commit a3329daf authored by Tan Le's avatar Tan Le Committed by Rémy Coutable

Bump `gitlab-styles` to 3.2.0

This brings extended `Include` folders for Rails/FindBy cop.
parent 420f1907
......@@ -7,6 +7,10 @@ require:
- ./rubocop/rubocop
- rubocop-rspec
inherit_mode:
merge:
- Include
AllCops:
TargetRubyVersion: 2.6
TargetRailsVersion: 5.0
......@@ -161,6 +165,14 @@ Rails/ApplicationRecord:
- ee/db/**/*.rb
- ee/spec/**/*.rb
Rails/FindBy:
Enabled: true
Include:
- 'ee/app/**/*.rb'
- 'ee/lib/**/*.rb'
- 'spec/**/*.rb'
- 'ee/spec/**/*.rb'
# GitLab ###################################################################
Gitlab/ModuleWithInstanceVariables:
......
......@@ -366,7 +366,7 @@ group :development, :test do
gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4'
gem 'gitlab-styles', '~> 3.1.0', require: false
gem 'gitlab-styles', '~> 3.2.0', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines
gem 'rubocop', '~> 0.74.0'
gem 'rubocop-performance', '~> 1.4.1'
......
......@@ -398,7 +398,7 @@ GEM
gitlab-puma (>= 2.7, < 5)
gitlab-sidekiq-fetcher (0.5.2)
sidekiq (~> 5)
gitlab-styles (3.1.0)
gitlab-styles (3.2.0)
rubocop (~> 0.74.0)
rubocop-gitlab-security (~> 0.1.0)
rubocop-performance (~> 1.4.1)
......@@ -1240,7 +1240,7 @@ DEPENDENCIES
gitlab-puma (~> 4.3.3.gitlab.2)
gitlab-puma_worker_killer (~> 0.1.1.gitlab.1)
gitlab-sidekiq-fetcher (= 0.5.2)
gitlab-styles (~> 3.1.0)
gitlab-styles (~> 3.2.0)
gitlab_chronic_duration (~> 0.10.6.2)
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.2)
......
......@@ -98,8 +98,7 @@ module DesignManagement
strong_memoize(:most_recent_action) do
::DesignManagement::Action
.most_recent.up_to_version(version)
.where(design: design)
.first
.find_by(design: design)
end
end
......
......@@ -93,12 +93,15 @@ module Gitlab
# Commit.last_for_path(repo, 'master', 'Gemfile')
#
def last_for_path(repo, ref, path = nil)
# rubocop: disable Rails/FindBy
# This is not where..first from ActiveRecord
where(
repo: repo,
ref: ref,
path: path,
limit: 1
).first
# rubocop: enable Rails/FindBy
end
# Get commits between two revspecs
......
......@@ -38,9 +38,8 @@ module Gitlab
identities = ::Identity.arel_table
User.select(:id)
.joins(:identities).where(identities[:provider].eq(:github)
.and(identities[:extern_uid].eq(id)))
.first
.joins(:identities)
.find_by(identities[:provider].eq(:github).and(identities[:extern_uid].eq(id)))
.try(:id)
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -39,7 +39,10 @@ describe Gitlab::Git::Tree, :seed_helper do
it { expect(dir.flat_path).to eq('encoding') }
context :subdir do
# rubocop: disable Rails/FindBy
# This is not ActiveRecord where..first
let(:subdir) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files').first }
# rubocop: enable Rails/FindBy
it { expect(subdir).to be_kind_of Gitlab::Git::Tree }
it { expect(subdir.id).to eq('a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba') }
......@@ -50,7 +53,10 @@ describe Gitlab::Git::Tree, :seed_helper do
end
context :subdir_file do
# rubocop: disable Rails/FindBy
# This is not ActiveRecord where..first
let(:subdir_file) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files/ruby').first }
# rubocop: enable Rails/FindBy
it { expect(subdir_file).to be_kind_of Gitlab::Git::Tree }
it { expect(subdir_file.id).to eq('7e3e39ebb9b2bf433b4ad17313770fbe4051649c') }
......@@ -63,7 +69,10 @@ describe Gitlab::Git::Tree, :seed_helper do
context :flat_path do
let(:filename) { 'files/flat/path/correct/content.txt' }
let(:oid) { create_file(filename) }
# rubocop: disable Rails/FindBy
# This is not ActiveRecord where..first
let(:subdir_file) { Gitlab::Git::Tree.where(repository, oid, 'files/flat').first }
# rubocop: enable Rails/FindBy
let(:repository_rugged) { Rugged::Repository.new(File.join(SEED_STORAGE_PATH, TEST_REPO_PATH)) }
it { expect(subdir_file.flat_path).to eq('files/flat/path/correct') }
......
......@@ -87,7 +87,7 @@ describe Ci::RetryPipelineService, '#execute' do
it 'creates a new job for report job in this case' do
service.execute(pipeline)
expect(statuses.where(name: 'report 1').first).to be_retried
expect(statuses.find_by(name: 'report 1', status: 'failed')).to be_retried
end
end
......
......@@ -5,7 +5,11 @@ require 'spec_helper'
describe 'projects/tree/_tree_row' do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
# rubocop: disable Rails/FindBy
# This is not ActiveRecord where..first
let(:blob_item) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files/ruby').first }
# rubocop: enable Rails/FindBy
before do
assign(:project, project)
......
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