Commit 077c6355 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'use_upstream_expect_offense' into 'master'

[RUN AS-IF-FOSS] Use upstream ExpectOffense module

See merge request gitlab-org/gitlab!34608
parents c5173dec 5114bdf5
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/gitlab/duplicate_spec_location' require_relative '../../../../rubocop/cop/gitlab/duplicate_spec_location'
describe RuboCop::Cop::Gitlab::DuplicateSpecLocation do describe RuboCop::Cop::Gitlab::DuplicateSpecLocation, type: :rubocop do
include RuboCop::RSpec::ExpectOffense
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/graphql/authorize_types' require_relative '../../../../rubocop/cop/graphql/authorize_types'
describe RuboCop::Cop::Graphql::AuthorizeTypes do describe RuboCop::Cop::Graphql::AuthorizeTypes, type: :rubocop do
include RuboCop::RSpec::ExpectOffense
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/graphql/descriptions' require_relative '../../../../rubocop/cop/graphql/descriptions'
describe RuboCop::Cop::Graphql::Descriptions do describe RuboCop::Cop::Graphql::Descriptions, type: :rubocop do
include RuboCop::RSpec::ExpectOffense
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_column_with_default' require_relative '../../../../rubocop/cop/migration/add_column_with_default'
describe RuboCop::Cop::Migration::AddColumnWithDefault do describe RuboCop::Cop::Migration::AddColumnWithDefault, type: :rubocop do
include CopHelper include CopHelper
let(:cop) { described_class.new } let(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require_relative '../../../../rubocop/cop/migration/add_columns_to_wide_tables' require_relative '../../../../rubocop/cop/migration/add_columns_to_wide_tables'
describe RuboCop::Cop::Migration::AddColumnsToWideTables do describe RuboCop::Cop::Migration::AddColumnsToWideTables, type: :rubocop do
include CopHelper include CopHelper
let(:cop) { described_class.new } let(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_concurrent_foreign_key' require_relative '../../../../rubocop/cop/migration/add_concurrent_foreign_key'
describe RuboCop::Cop::Migration::AddConcurrentForeignKey do describe RuboCop::Cop::Migration::AddConcurrentForeignKey, type: :rubocop do
include CopHelper include CopHelper
let(:cop) { described_class.new } let(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_concurrent_index' require_relative '../../../../rubocop/cop/migration/add_concurrent_index'
describe RuboCop::Cop::Migration::AddConcurrentIndex do describe RuboCop::Cop::Migration::AddConcurrentIndex, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_index' require_relative '../../../../rubocop/cop/migration/add_index'
describe RuboCop::Cop::Migration::AddIndex do describe RuboCop::Cop::Migration::AddIndex, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_limit_to_text_columns' require_relative '../../../../rubocop/cop/migration/add_limit_to_text_columns'
describe RuboCop::Cop::Migration::AddLimitToTextColumns do describe RuboCop::Cop::Migration::AddLimitToTextColumns, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_reference' require_relative '../../../../rubocop/cop/migration/add_reference'
describe RuboCop::Cop::Migration::AddReference do describe RuboCop::Cop::Migration::AddReference, type: :rubocop do
include CopHelper include CopHelper
let(:cop) { described_class.new } let(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/add_timestamps' require_relative '../../../../rubocop/cop/migration/add_timestamps'
describe RuboCop::Cop::Migration::AddTimestamps do describe RuboCop::Cop::Migration::AddTimestamps, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/datetime' require_relative '../../../../rubocop/cop/migration/datetime'
describe RuboCop::Cop::Migration::Datetime do describe RuboCop::Cop::Migration::Datetime, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/hash_index' require_relative '../../../../rubocop/cop/migration/hash_index'
describe RuboCop::Cop::Migration::HashIndex do describe RuboCop::Cop::Migration::HashIndex, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/prevent_strings' require_relative '../../../../rubocop/cop/migration/prevent_strings'
describe RuboCop::Cop::Migration::PreventStrings do describe RuboCop::Cop::Migration::PreventStrings, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/remove_column' require_relative '../../../../rubocop/cop/migration/remove_column'
describe RuboCop::Cop::Migration::RemoveColumn do describe RuboCop::Cop::Migration::RemoveColumn, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/remove_concurrent_index' require_relative '../../../../rubocop/cop/migration/remove_concurrent_index'
describe RuboCop::Cop::Migration::RemoveConcurrentIndex do describe RuboCop::Cop::Migration::RemoveConcurrentIndex, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/remove_index' require_relative '../../../../rubocop/cop/migration/remove_index'
describe RuboCop::Cop::Migration::RemoveIndex do describe RuboCop::Cop::Migration::RemoveIndex, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/safer_boolean_column' require_relative '../../../../rubocop/cop/migration/safer_boolean_column'
describe RuboCop::Cop::Migration::SaferBooleanColumn do describe RuboCop::Cop::Migration::SaferBooleanColumn, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/timestamps' require_relative '../../../../rubocop/cop/migration/timestamps'
describe RuboCop::Cop::Migration::Timestamps do describe RuboCop::Cop::Migration::Timestamps, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/with_lock_retries_disallowed_method' require_relative '../../../../rubocop/cop/migration/with_lock_retries_disallowed_method'
describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod do describe RuboCop::Cop::Migration::WithLockRetriesDisallowedMethod, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/with_lock_retries_with_change' require_relative '../../../../rubocop/cop/migration/with_lock_retries_with_change'
describe RuboCop::Cop::Migration::WithLockRetriesWithChange do describe RuboCop::Cop::Migration::WithLockRetriesWithChange, type: :rubocop do
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/ar_count_each.rb' require_relative '../../../../rubocop/cop/performance/ar_count_each.rb'
describe RuboCop::Cop::Performance::ARCountEach, type: :rubocop do describe RuboCop::Cop::Performance::ARCountEach, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/ar_exists_and_present_blank.rb' require_relative '../../../../rubocop/cop/performance/ar_exists_and_present_blank.rb'
describe RuboCop::Cop::Performance::ARExistsAndPresentBlank, type: :rubocop do describe RuboCop::Cop::Performance::ARExistsAndPresentBlank, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/performance/readlines_each' require_relative '../../../../rubocop/cop/performance/readlines_each'
describe RuboCop::Cop::Performance::ReadlinesEach, type: :rubocop do describe RuboCop::Cop::Performance::ReadlinesEach, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware' ...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware'
describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware, type: :rubocop do describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
# frozen_string_literal: true # frozen_string_literal: true
require 'fast_spec_helper' require 'fast_spec_helper'
require 'rubocop' require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/top_level_describe_path' require_relative '../../../../rubocop/cop/rspec/top_level_describe_path'
describe RuboCop::Cop::RSpec::TopLevelDescribePath do describe RuboCop::Cop::RSpec::TopLevelDescribePath, type: :rubocop do
include RuboCop::RSpec::ExpectOffense
include CopHelper include CopHelper
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/bulk_perform_with_context' ...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/bulk_perform_with_context'
describe RuboCop::Cop::Scalability::BulkPerformWithContext, type: :rubocop do describe RuboCop::Cop::Scalability::BulkPerformWithContext, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/cron_worker_context' ...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/cron_worker_context'
describe RuboCop::Cop::Scalability::CronWorkerContext, type: :rubocop do describe RuboCop::Cop::Scalability::CronWorkerContext, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/file_uploads' ...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/file_uploads'
describe RuboCop::Cop::Scalability::FileUploads, type: :rubocop do describe RuboCop::Cop::Scalability::FileUploads, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/idempotent_worker' ...@@ -6,7 +6,6 @@ require_relative '../../../../rubocop/cop/scalability/idempotent_worker'
describe RuboCop::Cop::Scalability::IdempotentWorker, type: :rubocop do describe RuboCop::Cop::Scalability::IdempotentWorker, type: :rubocop do
include CopHelper include CopHelper
include ExpectOffense
subject(:cop) { described_class.new } subject(:cop) { described_class.new }
......
...@@ -103,7 +103,6 @@ RSpec.configure do |config| ...@@ -103,7 +103,6 @@ RSpec.configure do |config|
config.include ActiveJob::TestHelper config.include ActiveJob::TestHelper
config.include ActiveSupport::Testing::TimeHelpers config.include ActiveSupport::Testing::TimeHelpers
config.include CycleAnalyticsHelpers config.include CycleAnalyticsHelpers
config.include ExpectOffense
config.include FactoryBot::Syntax::Methods config.include FactoryBot::Syntax::Methods
config.include FixtureHelpers config.include FixtureHelpers
config.include NonExistingRecordsHelpers config.include NonExistingRecordsHelpers
......
# frozen_string_literal: true
require 'rubocop/rspec/support'
# https://github.com/backus/rubocop-rspec/blob/master/spec/support/expect_offense.rb
# rubocop-rspec gem extension of RuboCop's ExpectOffense module.
#
# This mixin is the same as rubocop's ExpectOffense except the default
# filename ends with `_spec.rb`
module ExpectOffense
include RuboCop::RSpec::ExpectOffense
DEFAULT_FILENAME = 'example_spec.rb'.freeze
def expect_offense(source, filename = DEFAULT_FILENAME)
super
end
def expect_no_offenses(source, filename = DEFAULT_FILENAME)
super
end
end
...@@ -4,7 +4,7 @@ require_relative "helpers/stub_configuration" ...@@ -4,7 +4,7 @@ require_relative "helpers/stub_configuration"
require_relative "helpers/stub_metrics" require_relative "helpers/stub_metrics"
require_relative "helpers/stub_object_storage" require_relative "helpers/stub_object_storage"
require_relative "helpers/stub_env" require_relative "helpers/stub_env"
require_relative "helpers/expect_offense" require 'rubocop/rspec/support'
RSpec.configure do |config| RSpec.configure do |config|
config.mock_with :rspec config.mock_with :rspec
...@@ -15,5 +15,5 @@ RSpec.configure do |config| ...@@ -15,5 +15,5 @@ RSpec.configure do |config|
config.include StubObjectStorage config.include StubObjectStorage
config.include StubENV config.include StubENV
config.include ExpectOffense, type: :rubocop config.include RuboCop::RSpec::ExpectOffense, type: :rubocop
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