-
Notifications
You must be signed in to change notification settings - Fork 13
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
rfc7: break long test expressions to one per line #437
Conversation
35f349e
to
3b06745
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except does example need to be fixed or maybe de-tabbed?
spec_7.rst
Outdated
&& (out->bytes > MIN_BYTES | ||
&& out->bytes <= MAX_BYTES)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er that doesn't appear to be at the same indent level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note the parens, its style is if (A && (B &&C))
leading to the longer version
if (long-test-1
&& (long-test-2
&& long-test-3)) {
}
i added it to demonstrate that a long expression within an expression should also be broken up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I misread that.
However, do we want that? I would not have put a line break on the second (compound) expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, lets tweak for this example. I changed it to
+ if (out->type == MY_EXPECTED_TYPE
+ && out->bytes > LOW_END_RANGE
+ && out->bytes < HIGH_END_RANGE) {
+ ...
+ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Controversy avoided :-)
Problem: We've adopted a defacto guideline that long test expressions connected by "AND" or "OR" operators should be broken to one test expression per line. This is not documented. Add this to RFC 7.
3b06745
to
11aa0bc
Compare
re-pushed, tweaking the example per conversation above |
Problem: We've adopted a defacto guideline that long test expressions connected by "AND" or "OR" operators should be broken to one test expression per line. This is not documented.
Add this to RFC 7.