Skip to content

Commit

Permalink
Merge pull request #37 from ament/patches
Browse files Browse the repository at this point in the history
enforce single line comments for closing namespaces
  • Loading branch information
dirk-thomas committed Nov 5, 2015
2 parents f91d820 + 2855718 commit 4cb1932
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ament_cpplint/ament_cpplint/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2164,15 +2164,15 @@ def CheckEnd(self, filename, clean_lines, linenum, error):
# expected namespace.
if self.name:
# Named namespace
if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
if not Match((r'};*\s*(//).*\bnamespace\s+' + re.escape(self.name) +
r'[\*/\.\\\s]*$'),
line):
error(filename, linenum, 'readability/namespace', 5,
'Namespace should be terminated with "// namespace %s"' %
self.name)
else:
# Anonymous namespace
if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
if not Match(r'};*\s*(//).*\bnamespace[\*/\.\\\s]*$', line):
# If "// namespace anonymous" or "// anonymous namespace (more text)",
# mention "// anonymous namespace" as an acceptable form
if Match(r'}.*\b(namespace anonymous|anonymous namespace)\b', line):
Expand Down
3 changes: 3 additions & 0 deletions ament_cpplint/bin/ament_cpplint
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ def append_file_to_group(groups, path):
repo_root = None
p = path
while p and repo_root is None:
# abort if root is reached
if os.path.dirname(p) == p:
break
p = os.path.dirname(p)
for marker in ['.git', '.hg', '.svn']:
if os.path.exists(os.path.join(p, marker)):
Expand Down

0 comments on commit 4cb1932

Please sign in to comment.