Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReport tidy error for space after ( #13361
Conversation
highfive
commented
Sep 21, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @nox (or someone else) soon. |
highfive
commented
Sep 21, 2016
|
Heads up! This PR modifies the following files:
|
| @@ -483,6 +483,7 @@ def check_rust(file_name, lines): | |||
| (r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import", | |||
| lambda match, line: line.startswith('use ')), | |||
| (r"^\s*else {", "else braces should be on the same line", no_filter), | |||
| (r"(fn )?[A-Za-z0-9_<>]+\( [A-Za-z0-9]", "extra space after (", no_filter), | |||
This comment has been minimized.
This comment has been minimized.
jdm
Sep 21, 2016
•
Member
What happens if we just match \(\s without any of the surrounding characters? Do we get false positives?
This comment has been minimized.
This comment has been minimized.
mylainos
Sep 22, 2016
Author
Contributor
Yes, if you consider macro false positive.
Example:
macro_rules! declare_viewport_descriptor {
( $( $variant: ident($data: ident), )+ ) => {
declare_viewport_descriptor_inner!([] [ $( $variant($data), )+ ] 0);
};
}
This comment has been minimized.
This comment has been minimized.
mylainos
Sep 22, 2016
Author
Contributor
With [^$]\(\s there is only one error due to macro (here):
macro_rules! thread_types ( ( $( $fun:ident = $flag:ident ; )* ) => (
|
Also, please update the files once you're done :) |
| @@ -22,7 +22,7 @@ bitflags! { | |||
| } | |||
| } | |||
|
|
|||
| macro_rules! thread_types ( ( $( $fun:ident = $flag:ident ; )* ) => ( | |||
| macro_rules! thread_types (($( $fun:ident = $flag:ident ; )* ) => ( | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Sep 22, 2016
Member
I'm not sure whether the spaces should be fixed for this macro. It had a valid style, I believe?
This comment has been minimized.
This comment has been minimized.
| @@ -483,6 +483,7 @@ def check_rust(file_name, lines): | |||
| (r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import", | |||
| lambda match, line: line.startswith('use ')), | |||
| (r"^\s*else {", "else braces should be on the same line", no_filter), | |||
| (r"[^\(][^$]\([ \t\r\v\f][^\(]", "extra space after (", no_filter), | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Sep 23, 2016
Member
We don't have to explicitly make it ignore macros. This could be a bit more simpler. Since we're concentrating on function names, we can assume that there shouldn't be any space or $ before the parentheses. Also, we don't want the vertical space, form feed and carriage return checks - just the space and tab should be fine :)
|
Please squash the commits and we'll be good to go :) |
|
Done ! |
|
Thanks! @bors-servo r+ |
|
|
Report tidy error for space after ( <!-- Please describe your changes on the following line: --> Add report in tidy for code which have a space after the `(` like `some_function( argument)` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13350 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13361) <!-- Reviewable:end -->
|
|
mylainos commentedSep 21, 2016
•
edited by larsbergstrom
Add report in tidy for code which have a space after the
(likesome_function( argument)./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is