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