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 IfNode#branches to return both branches when called on ternary conditional #146

Merged
merged 1 commit into from Nov 4, 2020

Conversation

fatkodima
Copy link
Contributor

Currently, it is returning only 1 branch.

@marcandre marcandre merged commit 94a8f87 into rubocop:master Nov 4, 2020
@marcandre
Copy link
Contributor

Good catch, thanks.

Expect a release later today.

let(:source) { 'foo? ? :foo : 42' }

it { expect(if_node.branches.size).to eq(2) }
it { expect(if_node.branches).to all(be_literal) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I think you can do both in a single expectaction to match [be_literal, be_literal]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just stick to the existing codestyle and replicated the nearest similar example 😄

@marcandre
Copy link
Contributor

Oh, didn't notice, but the Changelog entry was misplaced.

Best use rake changelog:... in the future!

@marcandre
Copy link
Contributor

Released 1.1.1, thanks!

@fatkodima
Copy link
Contributor Author

I do not understand, how I did not noticed that it is not under master? It is the second time, at least, that I remember. 💦

@marcandre
Copy link
Contributor

I do not understand, how I did not noticed that it is not under master? It is the second time, at least, that I remember. 💦

You're probably too used to rubocop with a gazillion things in the "current" section

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.

None yet

2 participants