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

assert: replace many if's with if-else statement #14043

Closed
wants to merge 2 commits into from
Closed

assert: replace many if's with if-else statement #14043

wants to merge 2 commits into from

Conversation

viktor-ku
Copy link
Contributor

If assert.fail has less than 3 arguments then some conditions will
be applied. However after applying one of them there is no need to
check for others.

Tests are passing

Checklist
Affected core subsystem(s)
  • assert

@nodejs-github-bot nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label Jul 2, 2017
@refack
Copy link
Contributor

refack commented Jul 2, 2017

Won't this conflict with #13973?

@BridgeAR
Copy link
Member

BridgeAR commented Jul 2, 2017

Yes, it will

@viktor-ku
Copy link
Contributor Author

viktor-ku commented Jul 2, 2017

Just in one place where lazyErrors where used. Should I remove that line?

@refack
Copy link
Contributor

refack commented Jul 2, 2017

Just in one place where lazyErrors where used. I can just remove this line?

All in good time... Let's see how thing progress...

@viktor-ku
Copy link
Contributor Author

Should I do something with this PR for it to progress? Or it is not depend on me?

@refack
Copy link
Contributor

refack commented Jul 2, 2017

Should I do something with this PR for it to progress? Or it is not depend on me?

@kuroljov first let me say, welcome, and thank you for your contribution 🥇
If you are not familiar with our review and landing process, it's covered in CONTRIBUTING.md

For now this PR looks good, if #13973 get's blocked this might land first, if #13973 lands first you'll need to rebase...

@viktor-ku
Copy link
Contributor Author

@refack Thank you. Well, let's see then

@viktor-ku
Copy link
Contributor Author

viktor-ku commented Jul 3, 2017

I've resolved the conflicts

@tniessen
Copy link
Member

tniessen commented Jul 3, 2017

@kuroljov It seems like you accidentally pushed a merge commit instead of your rebased changes. This makes it difficult to run CI against your changes and also requires a manual rebase while landing this PR. I assume you added https://github.com/nodejs/node.git as the upstream repository. If you did not, you can add it like this:

git remote add upstream https://github.com/nodejs/node.git

Please follow these steps to perform a proper rebase:

git checkout assert
git reset --hard 5362e0990ec01a1aad78123e05f4ceefb62f726f
git fetch upstream
git rebase upstream/master

There will likely be some conflicts at this point. Running git status shows you a list of "Unmerged paths", the files with conflicts will be marked as "both modified". After fixing the rebase conflicts in these files, you can continue:

git rebase --continue

If everything worked, you should have a single commit on top of our upstream master containing your changes. You can push the changes to your repository using

git push origin assert --force

If you need further assistance, please let me know.

(Based on #13852 (comment))

@refack refack mentioned this pull request Jul 3, 2017
4 tasks
If assert.fail has less than 3 arguments then some conditions will
be applied. However after applying one of them there is no need to
check for others.
@viktor-ku
Copy link
Contributor Author

@tniessen my bad. I pushed rebased assert branch and now it looks like it has no conflicts

lib/assert.js Outdated
@@ -62,18 +62,20 @@ function innerFail(actual, expected, message, operator, stackStartFunction) {
}

function fail(actual, expected, message, operator, stackStartFunction) {
if (arguments.length === 0) {
const args = arguments.length;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Could you name it argsLen

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 knew the argsLen will be the perfect name. Sure. Just give me a minute

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

💯

@tniessen tniessen self-assigned this Jul 3, 2017
@tniessen
Copy link
Member

tniessen commented Jul 3, 2017

tniessen pushed a commit that referenced this pull request Jul 5, 2017
Replace multiple mutually exclusive `if` statements with if-else
statements.

PR-URL: #14043
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
@tniessen
Copy link
Member

tniessen commented Jul 5, 2017

Landed in 6e86a70, thank you for your first contribution! 🎉 Keep up the good work! 🏅

CI on master: https://ci.nodejs.org/job/node-test-commit-linuxone/7086/

@tniessen tniessen closed this Jul 5, 2017
@viktor-ku
Copy link
Contributor Author

@tniessen thank you

@addaleax
Copy link
Member

This doesn’t seem to apply to v8.x, let me know if I’m mistaken.

@viktor-ku
Copy link
Contributor Author

@addaleax not it was not

@viktor-ku
Copy link
Contributor Author

@addaleax I misunderstood you. It can be landed on v8. Or if it can't then it definitely might be landed on v9. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants