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

Reintroduce 'C++' as a language option, but convert it to 'CPP' for consistency with uncrustify #302

Merged
merged 1 commit into from
Mar 3, 2021
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
10 changes: 8 additions & 2 deletions ament_uncrustify/ament_uncrustify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main(argv=sys.argv[1:]):
help='Exclude specific file names and directory names from the check')
parser.add_argument(
'--language',
choices=['C', 'CPP'],
choices=['C', 'C++', 'CPP'],
help="Passed to uncrustify as '-l <language>' to force a specific "
'language rather then choosing one based on file extension')
parser.add_argument(
Expand Down Expand Up @@ -104,9 +104,15 @@ def main(argv=sys.argv[1:]):
if args.xunit_file:
start_time = time.time()

# replace language set to 'C++' with 'CPP' to be more consistent with uncrustify
if args.language == 'C++':
language_ = 'CPP'
else:
language_ = args.language

files_by_language = get_files(
args.paths, {'C': c_extensions, 'CPP': cpp_extensions},
excludes=args.exclude, language=args.language)
excludes=args.exclude, language=language_)
if not files_by_language:
print('No files found', file=sys.stderr)
return 1
Expand Down