From e788eae37e746c512a5618c673b04eacaa3fff6a Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Wed, 6 Aug 2014 00:36:00 -0700 Subject: lint for copyright --- scripts/cpp_lint.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/cpp_lint.py b/scripts/cpp_lint.py index 3f0ca1c3..3f80e723 100755 --- a/scripts/cpp_lint.py +++ b/scripts/cpp_lint.py @@ -445,7 +445,7 @@ _RE_SUPPRESSION = re.compile(r'\bNOLINT(_NEXT_LINE)?\b(\([^)]*\))?') _error_suppressions = {} # Finds Copyright. -_RE_COPYRIGHT = re.compile(r'Copyright \d\d\d\d BVLC and contributors.') +_RE_COPYRIGHT = re.compile(r'Copyright') # The root directory used for deriving header guard CPP variable. # This is set by --root flag. @@ -1368,16 +1368,15 @@ def ReverseCloseExpression(clean_lines, linenum, pos): def CheckForCopyright(filename, lines, error): - """Logs an error if no Copyright message appears at the top of the file.""" + """Logs an error if a Copyright message appears at the top of the file.""" - # We'll say it should occur by line 10. Don't forget there's a + # We'll check up to line 10. Don't forget there's a # dummy line at the front. for line in xrange(1, min(len(lines), 11)): - if _RE_COPYRIGHT.search(lines[line], re.I): break - else: # means no copyright line was found - error(filename, 0, 'legal/copyright', 5, - 'BVLC copyright message not found. ' - 'You should have a line: "Copyright [year] BVLC and contributors."') + if _RE_COPYRIGHT.search(lines[line], re.I): + error(filename, 0, 'legal/copyright', 5, + 'Copyright message found. ' + 'You should not include a copyright line.') def GetHeaderGuardCPPVariable(filename): -- cgit v1.2.3