Class: RuboCop::Cop::RSpec::ExcessiveDocstringSpacing
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rspec/excessive_docstring_spacing.rb
Overview
Checks for excessive whitespace in example descriptions.
Constant Summary collapse
- MSG =
'Excessive whitespace.'
Instance Method Summary collapse
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#example_description(node) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rubocop/cop/rspec/excessive_docstring_spacing.rb', line 32 def_node_matcher :example_description, <<~PATTERN (send _ {#Examples.all #ExampleGroups.all} ${ $str $(dstr ({str dstr `sym} ...) ...) } ...) PATTERN |
#on_send(node) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/rspec/excessive_docstring_spacing.rb', line 39 def on_send(node) example_description(node) do |description_node, | return if description_node.heredoc? text = text() return unless excessive_whitespace?(text) add_whitespace_offense(description_node, text) end end |