Skip to content

Commit dd4d429

Browse files
committed
clang-tidy: exclude protobuf sources
Signed-off-by: Patrick Creighton <[email protected]>
1 parent 10660ec commit dd4d429

File tree

1 file changed

+9
-0
lines changed
  • ament_clang_tidy/ament_clang_tidy

1 file changed

+9
-0
lines changed

ament_clang_tidy/ament_clang_tidy/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ def is_gtest_source(file_name):
162162
def is_unittest_source(package, file_path):
163163
return ('%s/test/' % package) in file_path
164164

165+
def is_protobuf_source(file_name):
166+
if(file_name.endswith(".pb.cc") or file_name.endswith(".pb.h")):
167+
return True
168+
return False
169+
165170
def start_subprocess(full_cmd):
166171
output = ''
167172
try:
@@ -188,6 +193,10 @@ def start_subprocess(full_cmd):
188193
if is_unittest_source(package_name, item['file']):
189194
continue
190195

196+
# exclude auto-generated protobuf sources from being checked by clang-tidy
197+
if is_protobuf_source(os.path.basename(item['file'])):
198+
continue
199+
191200
files.append(item['file'])
192201
full_cmd = cmd + [item['file']]
193202
async_outputs.append(pool.apply_async(start_subprocess, (full_cmd,)))

0 commit comments

Comments
 (0)