Commit 6a480da9 authored by Jacopo's avatar Jacopo Committed by Rémy Coutable

Fixes begin false positive

parent 62c36041
......@@ -9,6 +9,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration
return unless Gitlab::Database.postgresql?
disable_statement_timeout
if Gitlab::Database.version.to_f >= 9.5
# Allow us to hot-patch the index manually ahead of the migration
execute "CREATE INDEX CONCURRENTLY IF NOT EXISTS #{INDEX_NAME} ON namespaces (lower(name));"
......@@ -21,6 +22,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration
return unless Gitlab::Database.postgresql?
disable_statement_timeout
if Gitlab::Database.version.to_f >= 9.2
execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME};"
else
......
......@@ -512,6 +512,7 @@ module Gitlab
batch_size: 10_000,
interval: 10.minutes
)
unless relation.model < EachBatch
raise TypeError, 'The relation must include the EachBatch module'
end
......
......@@ -14,6 +14,7 @@ module Gitlab
generate_config_map
spec['volumes'] = volumes_specification
end
::Kubeclient::Resource.new(metadata: metadata, spec: spec)
end
......
......@@ -99,7 +99,8 @@ module RuboCop
end
def begin_line?(line)
line =~ /^\s*@?(\w|\|+|=|\[|\]|\s)+begin/
# an assignment followed by a begin or ust a begin
line =~ /^\s*(@?(\w|\|+|=|\[|\]|\s)+begin|begin)/
end
def assignment_line?(line)
......
......@@ -94,6 +94,19 @@ describe RuboCop::Cop::LineBreakAroundConditionalBlock do
end
it "doesn't flag violation for #{conditional} preceded by a begin definition" do
source = <<~RUBY
begin
#{conditional} condition
do_something
end
end
RUBY
inspect_source(source)
expect(cop.offenses).to be_empty
end
it "doesn't flag violation for #{conditional} preceded by an assign/begin definition" do
source = <<~RUBY
@project ||= begin
#{conditional} condition
......
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