Last active
August 28, 2018 04:00
-
-
Save pansila/8fcd90aa66ce763b9d63a5bbda485d04 to your computer and use it in GitHub Desktop.
Patch of cpplint to filter whitespace/braces for opening brace of C function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/cpplint.py b/cpplint.py | |
| index 95c0c32..fc8f6ba 100755 | |
| --- a/cpplint.py | |
| +++ b/cpplint.py | |
| @@ -3897,6 +3897,8 @@ def CheckBraces(filename, clean_lines, linenum, error): | |
| # within the 80 character limit of the preceding line. | |
| prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0] | |
| if (not Search(r'[,;:}{(]\s*$', prevline) and | |
| + # test a C function definition | |
| + not Search(r'(void\s*|\(\s*|\w+(\s+\**\w+)+(,\s*\w+(\s+\**\w+)+)*\s*)\)', prevline) and | |
| not Match(r'\s*#', prevline) and | |
| not (GetLineWidth(prevline) > _line_length - 2 and '[]' in prevline)): | |
| error(filename, linenum, 'whitespace/braces', 4, |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test cases: