Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: RSpec/ExcessiveDocstringSpacing does not work well #1201

Closed
gruz0 opened this issue Oct 12, 2021 · 4 comments
Closed

Bug: RSpec/ExcessiveDocstringSpacing does not work well #1201

gruz0 opened this issue Oct 12, 2021 · 4 comments

Comments

@gruz0
Copy link

gruz0 commented Oct 12, 2021

Hi guys,

I've found bug in RSpec/ExcessiveDocstringSpacing after updating to 2.5.0.

Before:

context 'when contains \' character ' do; end

After rubocop -a:

context 'when contains ' character' do; end

Result:

spec/test_spec.rb: E: Lint/Syntax: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
    context 'when contains ' character' do; end
                             ^^^^^^^^^
@gruz0 gruz0 changed the title Bug: RSpec/ExcessiveDocstringSpacing remove extra Bug: RSpec/ExcessiveDocstringSpacing does not work well Oct 12, 2021
@pirj
Copy link
Member

pirj commented Oct 14, 2021

Thanks for reporting.
Very similar to #1189.
The example you've provided is convincing enough that your code is absolutely fine, and the cop (or actually all cops that deal with descriptions) misbehave with escaped quotes.

I suggested one approach in #1189 (comment), but it might not apply to this other cop. Chances are we'll have to improve gems we depend on to fix this (rubocop, rubocop-ast, parser).

Would you like to contribute a fix?

@gruz0
Copy link
Author

gruz0 commented Oct 14, 2021

I will try.

@pirj
Copy link
Member

pirj commented Oct 15, 2021

@G-Rath You might be interested, too. However, it's not ExcessiveDocstringSpacing to blame for this, as other cops suffer from such an incorrect autocorrection, too.

@pirj
Copy link
Member

pirj commented Jun 16, 2022

Quite unlikely that the fix is possible.

@pirj pirj closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants