rubocop-rspec
rubocop-rspec copied to clipboard
Cop Idea: Only xstr in description
If only xstr is passed to describe, context or it, the typo of " or ' is suspect in many cases.
Also, if only xstr is, it may not be a good description of describe or context or it. What do you think?
# bad
describe `time` do
end
# bad
context `time` do
end
# bad
it `time` do
end
Is this an issue from the real code? Why would anyone want to use that?
Is this an issue from the real code? Why would anyone want to use that?
Yes, it is. Strictly speaking I saw the it case I encountered.
The case of describe and context may not exist in the real world, but it would be nice to have, I think.
If those are typos, surely let’s add a cop to fix those
I guess someone who uses JavaScript template literals a lot wrote it by mistake. I've encountered this misuse too, but since this project was a Rails app, where Kernel#` is not used very often, I decided to enforce the %x literal.
Style/CommandLiteral:
EnforcedStyle: percent_x