Detect single-use shared_{context,examples} (or other setup?)
Opened this issue · 2 comments
After reading rubocop/rubocop#6786 (comment), it occurred to me that rspectre
could also count single-use setup. For let
s or similar this might be slightly aggressive (but maybe worth an optional flag), but it's almost certainly helpful for shared_*
tools. Inlining is almost always better when something is used ones.
I think both would be nice to have. I'd argue that even for shared_*
, it should only happen when passing a flag, though.
Right now rspectre
is a zero config tool that finds/removes clearly wrong things, and that makes it refreshingly straightforward to use and to convince people of "accepting" its suggestions, compared to e.g. rubocop.
A shared example might also be created on purpose for the first use case if more use cases are very likely to come up in the future.
An option to detect single-use let
s (and let me turn them into local variables) would be neat.