diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /rubocop/cop/rspec | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'rubocop/cop/rspec')
-rw-r--r-- | rubocop/cop/rspec/empty_line_after_shared_example.rb | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/rubocop/cop/rspec/empty_line_after_shared_example.rb b/rubocop/cop/rspec/empty_line_after_shared_example.rb deleted file mode 100644 index 5d09565bd5a..00000000000 --- a/rubocop/cop/rspec/empty_line_after_shared_example.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -require 'rubocop/rspec/final_end_location' -require 'rubocop/rspec/blank_line_separation' -require 'rubocop/rspec/language' - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after shared example blocks. - # - # @example - # # bad - # RSpec.describe Foo do - # it_behaves_like 'do this first' - # it_behaves_like 'does this' do - # end - # it_behaves_like 'does that' do - # end - # it_behaves_like 'do some more' - # end - # - # # good - # RSpec.describe Foo do - # it_behaves_like 'do this first' - # it_behaves_like 'does this' do - # end - # - # it_behaves_like 'does that' do - # end - # - # it_behaves_like 'do some more' - # end - # - # # fair - it's ok to have non-separated without blocks - # RSpec.describe Foo do - # it_behaves_like 'do this first' - # it_behaves_like 'does this' - # end - # - class EmptyLineAfterSharedExample < RuboCop::Cop::Cop - include RuboCop::RSpec::BlankLineSeparation - include RuboCop::RSpec::Language - - MSG = 'Add an empty line after `%<example>s` block.' - - def_node_matcher :shared_examples, - (SharedGroups::ALL + Includes::ALL).block_pattern - - def on_block(node) - shared_examples(node) do - break if last_child?(node) - - missing_separating_line(node) do |location| - add_offense(node, - location: location, - message: format(MSG, example: node.method_name)) - end - end - end - end - end - end -end |