dgollahon / rspectre

Exorcise the apparitions haunting your tests.
MIT License
75 stars 10 forks source link

Detect single-use shared_{context,examples} (or other setup?) #24

Open dgollahon opened 5 years ago

dgollahon commented 5 years ago

After reading https://github.com/rubocop-hq/rubocop/pull/6786#issue-255200134, it occurred to me that rspectre could also count single-use setup. For lets 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.

jaynetics commented 1 year ago

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.

bquorning commented 1 year ago

An option to detect single-use lets (and let me turn them into local variables) would be neat.