Class: RuboCop::Cop::RSpec::AlignLeftLetBrace
- Defined in:
- lib/rubocop/cop/rspec/align_left_let_brace.rb
Overview
Checks that left braces for adjacent single line lets are aligned.
Constant Summary collapse
- MSG =
'Align left let brace'
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
RSpec::Language::ALL, RSpec::Language::RSPEC
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Cop
Class Method Details
.autocorrect_incompatible_with ⇒ Object
23 24 25 |
# File 'lib/rubocop/cop/rspec/align_left_let_brace.rb', line 23 def self.autocorrect_incompatible_with [Layout::ExtraSpacing] end |
Instance Method Details
#autocorrect(let) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/rubocop/cop/rspec/align_left_let_brace.rb', line 35 def autocorrect(let) lambda do |corrector| corrector.insert_before( let.loc.begin, token_aligner.indent_for(let) ) end end |
#investigate(_processed_source) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/rubocop/cop/rspec/align_left_let_brace.rb', line 27 def investigate(_processed_source) return if processed_source.blank? token_aligner.offending_tokens.each do |let| add_offense(let, location: :begin) end end |