forked from cvmfs/cvmfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpplint.py.cvmfs-patch
73 lines (68 loc) · 3.7 KB
/
cpplint.py.cvmfs-patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- cpplint.py.orig 2015-01-29 14:06:52.991772057 +0100
+++ cpplint.py 2015-01-29 14:39:53.584877841 +0100
@@ -400,7 +400,7 @@
# uppercase character, such as Python.h or nsStringAPI.h, for example).
# - Lua headers.
_THIRD_PARTY_HEADERS_PATTERN = re.compile(
- r'^(?:[^/]*[A-Z][^/]*\.h|lua\.h|lauxlib\.h|lualib\.h)$')
+ r'^(?:[^/]*[A-Z][^/]*\.h|lua\.h|lauxlib\.h|lualib\.h|cvmfs_config\.h|sys/xattr\.h|gtest/gtest\.h|benchmark/benchmark\.h)$')
# Assertion macros. These are defined in base/logging.h and
@@ -1625,11 +1625,11 @@
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
- if re.search(r'Copyright', lines[line], re.I): break
+ if re.search(r'This file is part of the CernVM File System', lines[line], re.I): break
else: # means no copyright line was found
error(filename, 0, 'legal/copyright', 5,
- 'No copyright message found. '
- 'You should have a line: "Copyright [year] <Copyright Owner>"')
+ 'No cvmfs ownerhip tag found. '
+ 'You should have a line: "This file is part of the CernVM File System"')
def GetIndentLevel(line):
@@ -3907,8 +3907,11 @@
# perfectly: we just don't complain if the last non-whitespace character on
# the previous non-blank line is ',', ';', ':', '(', '{', or '}', or if the
# previous line starts a preprocessor block.
+ # Additionall allow an open brace when the previous line is a multi line
+ # method signature or if/for/while statement. That is: previous line ends
+ # on ) or const (t).
prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
- if (not Search(r'[,;:}{(]\s*$', prevline) and
+ if (not Search(r'[,;:}{()t>]\s*$', prevline) and
not Match(r'\s*#', prevline)):
error(filename, linenum, 'whitespace/braces', 4,
'{ should almost always be at the end of the previous line')
@@ -3927,12 +3930,12 @@
# find the ( after the if
pos = line.find('else if')
pos = line.find('(', pos)
- if pos > 0:
- (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
- brace_on_right = endline[endpos:].find('{') != -1
- if brace_on_left != brace_on_right: # must be brace after if
- error(filename, linenum, 'readability/braces', 5,
- 'If an else has a brace on one side, it should have it on both')
+ #if pos > 0:
+ # (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
+ # brace_on_right = endline[endpos:].find('{') != -1
+ # if brace_on_left != brace_on_right: # must be brace after if
+ # error(filename, linenum, 'readability/braces', 5,
+ # 'If an else has a brace on one side, it should have it on both')
elif Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line):
error(filename, linenum, 'readability/braces', 5,
'If an else has a brace on one side, it should have it on both')
@@ -4626,10 +4629,10 @@
#
# We also make an exception for Lua headers, which follow google
# naming convention but not the include convention.
- match = Match(r'#include\s*"([^/]+\.h)"', line)
- if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)):
- error(filename, linenum, 'build/include', 4,
- 'Include the directory when naming .h files')
+ #match = Match(r'#include\s*"([^/]+\.h)"', line)
+ #if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)):
+ # error(filename, linenum, 'build/include', 4,
+ # 'Include the directory when naming .h files')
# we shouldn't include a file more than once. actually, there are a
# handful of instances where doing so is okay, but in general it's