Skip to content
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
12 changes: 9 additions & 3 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,9 +1253,15 @@ def owned_directories(error_messages):
error_messages = []
owned_directories = owned_directories(error_messages)
if os.path.isfile(args.target_path):
if not args.target_path.startswith(EXCLUDED_PREFIXES) and args.target_path.endswith(
SUFFIXES):
error_messages += format_checker.check_format("./" + args.target_path)
# All of our EXCLUDED_PREFIXES start with "./", but the provided
# target path argument might not. Add it here if it is missing,
# and use that normalized path for both lookup and `check_format`.
normalized_target_path = args.target_path
if not normalized_target_path.startswith("./"):
normalized_target_path = "./" + normalized_target_path
if not normalized_target_path.startswith(
EXCLUDED_PREFIXES) and normalized_target_path.endswith(SUFFIXES):
error_messages += format_checker.check_format(normalized_target_path)
else:
results = []

Expand Down