Changeset View
Changeset View
Standalone View
Standalone View
test/lint/lint-format-strings.py
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | for f in args.file: | ||||
print("{}: Could not parse function call string \"{}(...)\": {}".format( | print("{}: Could not parse function call string \"{}(...)\": {}".format( | ||||
f.name, args.function_name, relevant_function_call_str)) | f.name, args.function_name, relevant_function_call_str)) | ||||
continue | continue | ||||
argument_count = len(parts) - 3 - args.skip_arguments | argument_count = len(parts) - 3 - args.skip_arguments | ||||
format_str = parse_string_content(parts[1 + args.skip_arguments]) | format_str = parse_string_content(parts[1 + args.skip_arguments]) | ||||
format_specifier_count = count_format_specifiers(format_str) | format_specifier_count = count_format_specifiers(format_str) | ||||
if format_specifier_count != argument_count: | if format_specifier_count != argument_count: | ||||
exit_code = 1 | exit_code = 1 | ||||
print("{}: Expected {} argument(s) after format string but found {} argument(s): {}".format( | print("{}: Expected {} argument(s) after format string but found {} argument(s) in {}".format( | ||||
f.name, format_specifier_count, argument_count, relevant_function_call_str)) | f.name, format_specifier_count, argument_count, relevant_function_call_str)) | ||||
continue | continue | ||||
sys.exit(exit_code) | sys.exit(exit_code) | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
main() | main() |