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

Fix bug when empty case nodes are present #3645

Merged
merged 1 commit into from
Oct 18, 2016
Merged

Fix bug when empty case nodes are present #3645

merged 1 commit into from
Oct 18, 2016

Conversation

tiagocasanovapt
Copy link
Contributor

@tiagocasanovapt tiagocasanovapt commented Oct 18, 2016

When defined inside a function, an empty when block from a case switch caused line 79 at lib/rubocop/cop/style/redundant_return.rb to fail due to a nil node.

I didn't add an IF in line 96 (check_case_node) to match similar cases because it failed to pass the tests, namely on line length.


Before submitting the PR make sure the following are checked:

  • Documentation updated with rake generate_cops_documentation
  • Wrote good commit messages.
  • [ ] Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

Fix bug when empty case nodes are present

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 18, 2016

The fix looks good, but the commit message doesn't match our guidelines.

@tiagocasanovapt tiagocasanovapt changed the title - fix bug when empty case nodes are present Fix bug when empty case nodes are present Oct 18, 2016
@tiagocasanovapt
Copy link
Contributor Author

Sorry, I assumed "Bullet points are okay, too", which i'm more used to. I've edited the commit message and the PR title.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 18, 2016

One more thing - you forgot to add yourself to the bottom of the changelog. You'll also need to rebase your PR on top of the current master.

@tiagocasanovapt
Copy link
Contributor Author

Done & done. Please review. 👍

@bbatsov bbatsov merged commit 1093cc7 into rubocop:master Oct 18, 2016
bbatsov added a commit that referenced this pull request Oct 18, 2016
Fix bug when empty case nodes are present
@tiagocasanovapt tiagocasanovapt deleted the empty_case_nodes branch October 19, 2016 09:26
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

Successfully merging this pull request may close these issues.

2 participants