mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
cpplint: disallow if one-liners
This commit is contained in:
parent
7063c59b97
commit
2bc30f239b
22 changed files with 340 additions and 168 deletions
4
tools/cpplint.py
vendored
4
tools/cpplint.py
vendored
|
@ -1764,6 +1764,10 @@ def CheckSpacing(filename, clean_lines, linenum, error):
|
|||
error(filename, linenum, 'whitespace/operators', 4,
|
||||
'Missing spaces around =')
|
||||
|
||||
if Match(r'^\s*(if|while) .*[^\{,)&|\\]$', line):
|
||||
error(filename, linenum, 'whitespace/if-one-line', 4,
|
||||
'If\'s body on the same line as if itself')
|
||||
|
||||
# It's ok not to have spaces around binary operators like + - * /, but if
|
||||
# there's too little whitespace, we get concerned. It's hard to tell,
|
||||
# though, so we punt on this one for now. TODO.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue