Skip to content

Commit

Permalink
Exclude folders having AMENT_IGNORE in ament_flake8 script (#211)
Browse files Browse the repository at this point in the history
Signed-off-by: Hao Peng <hao.peng@apex.ai>
  • Loading branch information
t0ny-peng authored Feb 27, 2020
1 parent 608c41e commit 418476e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ament_flake8/ament_flake8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def main(argv=sys.argv[1:]):
print("Could not find config file '%s'" % args.config_file, file=sys.stderr)
return 1

# Filter out folders having AMENT_IGNORE
if args.excludes is None:
args.excludes = []
for dirpath, dirnames, filenames in os.walk(os.getcwd()):
if 'AMENT_IGNORE' in filenames:
dirnames[:] = []
args.excludes.append(dirpath)

report = generate_flake8_report(
args.config_file, args.paths, args.excludes,
max_line_length=args.linelength)
Expand Down Expand Up @@ -154,7 +162,7 @@ def generate_flake8_report(config_file, paths, excludes, max_line_length=None):
flake8_argv = []
if config_file is not None:
flake8_argv.append('--config={0}'.format(config_file))
if excludes is not None:
if len(excludes) > 0:
flake8_argv.append('--exclude={0}'.format(','.join(excludes)))

if max_line_length is not None:
Expand Down

0 comments on commit 418476e

Please sign in to comment.