Skip to content

Commit

Permalink
(ament_xmllint) add extensions argument (#456)
Browse files Browse the repository at this point in the history
* (ament_xmllint) add extensions argument

Signed-off-by: Matthijs van der Burgh <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
MatthijsBurgh and clalancette authored Oct 24, 2023
1 parent 10660ec commit 7a5876e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ament_xmllint/ament_xmllint/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


def main(argv=sys.argv[1:]):
extensions = ['xml']
default_extensions = ['xml']

parser = argparse.ArgumentParser(
description='Check XML markup using xmllint.',
Expand All @@ -38,16 +38,22 @@ def main(argv=sys.argv[1:]):
'paths',
nargs='*',
default=[os.curdir],
help='The files or directories to check. For directories files ending '
'in %s will be considered.' %
', '.join(["'.%s'" % e for e in extensions]))
help='The files or directories to check. For directories, only files ending '
'in %s will be considered (unless overruled by the --extensions '
'option)' %
', '.join(["'.%s'" % e for e in default_extensions]))
parser.add_argument(
'--exclude',
nargs='*',
default=[],
help='Exclude specific file names and directory names from the check')
# not using a file handle directly
# in order to prevent leaving an empty file when something fails early
parser.add_argument(
'--extensions',
nargs='*',
default=default_extensions,
help='The file extensions of the files to check')
parser.add_argument(
'--xunit-file',
help='Generate a xunit compliant XML file')
Expand All @@ -56,7 +62,7 @@ def main(argv=sys.argv[1:]):
if args.xunit_file:
start_time = time.time()

files = get_files(args.paths, extensions, args.exclude)
files = get_files(args.paths, args.extensions, args.exclude)
if not files:
print('No files found', file=sys.stderr)
return 1
Expand Down

0 comments on commit 7a5876e

Please sign in to comment.