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

BlockDelimiters cop: Semantic block incorrectly recognised/autocorrected as procedural block #2021

Closed
myabc opened this issue Jul 8, 2015 · 1 comment
Labels

Comments

@myabc
Copy link

myabc commented Jul 8, 2015

Environment

rubocop (0.32.1)

with these settings:

BlockDelimiters:
  Enabled: true
  EnforcedStyle: semantic

Issue

To reproduce:

rubocop -a on the following code:

      h[i] = [predecessor.detect { |j| j[key] == i },
              current.detect { |j| j[key] == i }]

will incorrectly flag an offense:

example.rb:1:30: C: [Corrected] Prefer do...end over {...} for procedural blocks.
  h[i] = [predecessor.detect { |j| j[key] == i },

and rewrite the code as such:

      h[i] = [predecessor.detect do |j| j[key] == i end,
              current.detect { |j| j[key] == i }]
myabc referenced this issue in myabc/openproject Jul 8, 2015
Signed-off-by: Alex Coles <alex@alexbcoles.com>
myabc added a commit to myabc/openproject that referenced this issue Jul 8, 2015
Reported as issue upstream:
rubocop/rubocop#2021

[ci skip]

Signed-off-by: Alex Coles <alex@alexbcoles.com>
@myabc
Copy link
Author

myabc commented Jul 8, 2015

/ @NobodysNightmare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants