Skip to content

Commit

Permalink
fixup! Implement auto-correct for ScatteredLet cop
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Krizhanovski committed Apr 28, 2020
1 parent 97be3a6 commit 1afc5b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/rubocop/cop/rspec/scattered_let.rb
Expand Up @@ -38,7 +38,9 @@ def on_block(node)
def autocorrect(node)
lambda do |corrector|
first_let = find_first_let(node.parent)
RuboCop::RSpec::Corrector::MoveNode.new(node, corrector, processed_source).move_after(first_let)
RuboCop::RSpec::Corrector::MoveNode.new(
node, corrector, processed_source
).move_after(first_let)
end
end

Expand Down
8 changes: 7 additions & 1 deletion manual/cops_rspec.md
Expand Up @@ -2723,7 +2723,7 @@ EnforcedStyle | `and_return` | `and_return`, `block`

Enabled by default | Supports autocorrection
--- | ---
Enabled | No
Enabled | Yes

Checks for let scattered across the example group.

Expand Down Expand Up @@ -2751,6 +2751,12 @@ describe Foo do
end
```

### Configurable attributes

Name | Default value | Configurable values
--- | --- | ---
VersionChanged | `1.39` | String

### References

* [https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet](https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet)
Expand Down

0 comments on commit 1afc5b3

Please sign in to comment.