Sha256: 098635e4fbf8845bf14bb4ada6dca64d2d31f70a54fd2e5673ced162b6fa89ac
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require 'rubocop-rspec' module Gitlab module Styles module Rubocop module Cop module RSpec # Checks if there is an empty line after let blocks. # # @example # # bad # RSpec.describe Foo do # let(:something) { 'something' } # let(:another_thing) do # end # let(:something_else) do # end # let(:last_thing) { 'last thing' } # end # # # good # RSpec.describe Foo do # let(:something) { 'something' } # let(:another_thing) do # end # # let(:something_else) do # end # # let(:last_thing) { 'last thing' } # end # # # good - it's ok to have non-separated without do/end blocks # RSpec.describe Foo do # let(:something) { 'something' } # let(:last_thing) { 'last thing' } # end # class EmptyLineAfterLetBlock < RuboCop::Cop::RSpec::Cop include RuboCop::RSpec::BlankLineSeparation MSG = 'Add an empty line after `%<let>s` block.' def_node_matcher :lets, Helpers::ALL.block_pattern def on_block(node) lets(node) do break if last_child?(node) next if node.single_line? missing_separating_line(node) do |location| add_offense(node, location: location, message: format(MSG, let: node.method_name)) end end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gitlab-styles-4.3.0 | lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb |