Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend copyright checker to allow for doxygen-style copyright #108

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ament_copyright/ament_copyright/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def search_copyright_information(content):
year = '\d{4}'
year_range = '%s-%s' % (year, year)
year_or_year_range = '(?:%s|%s)' % (year, year_range)
pattern = '^[^\n\r]?\s*Copyright(?:\s+\(c\))?\s+(%s(?:,\s*%s)*),?\s+([^\n\r]+)$' % \
pattern = '^[^\n\r]?\s*(?:\\\copyright\s*)?' \
'Copyright(?:\s+\(c\))?\s+(%s(?:,\s*%s)*),?\s+([^\n\r]+)$' % \
(year_or_year_range, year_or_year_range)
regex = re.compile(pattern, re.DOTALL | re.MULTILINE)

Expand Down Expand Up @@ -239,7 +240,8 @@ def is_shebang_line(content, index):

def get_comment_block(content, index):
# regex for matching the beginning of the first comment
pattern = '^(#|//)'
# check for doxygen comments (///) before regular comments (//)
pattern = '^(#|///|//)'
regex = re.compile(pattern, re.MULTILINE)

match = regex.search(content, index)
Expand Down