Skip to content

Commit

Permalink
lint for copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
shelhamer committed Aug 7, 2014
1 parent 72effc0 commit e788eae
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/cpp_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@
_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.
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit e788eae

Please sign in to comment.