Class: Shirobai::Cop::RSpec::EmptyLineAfterExample

Inherits:
RuboCop::Cop::Base
  • Object
show all
Extended by:
RuboCop::Cop::AutoCorrector
Includes:
BundleEligible, EmptyLineSeparationSupport
Defined in:
lib/shirobai/cop/rspec/empty_line_after_example.rb

Overview

Drop-in Rust reimplementation of RSpec/EmptyLineAfterExample (rubocop-rspec 3.10.2).

The Rust rule flags every plain-block example (it/specify/its/...) that has a following sibling in a :begin sequence, minus the allowed consecutive-one-liner shape (AllowConsecutiveOneLiners, default true). The shared support module replays stock's comment/blank/directive walk and autocorrect. Probed quirks live in empty_line_after_example_edge_cases_spec.rb.

Constant Summary collapse

MSG =
"Add an empty line after `%<example>s`."

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EmptyLineSeparationSupport

#emit_empty_line_offenses

Class Method Details

.badgeObject



23
# File 'lib/shirobai/cop/rspec/empty_line_after_example.rb', line 23

def self.badge = RuboCop::Cop::Badge.parse(cop_name)

.bundle_args(config) ⇒ Object

AllowConsecutiveOneLiners (default true) -> segment num.



26
27
28
# File 'lib/shirobai/cop/rspec/empty_line_after_example.rb', line 26

def self.bundle_args(config)
  [config.for_badge(badge).fetch("AllowConsecutiveOneLiners", true) ? 1 : 0]
end

.cop_nameObject



22
# File 'lib/shirobai/cop/rspec/empty_line_after_example.rb', line 22

def self.cop_name = "RSpec/EmptyLineAfterExample"

Instance Method Details

#on_new_investigationObject



30
31
32
33
34
# File 'lib/shirobai/cop/rspec/empty_line_after_example.rb', line 30

def on_new_investigation
  emit_empty_line_offenses(resolved_offenses) do |method|
    format(MSG, example: method)
  end
end