Skip to content

Commit

Permalink
Make error message in enforce_glob more copy-pasteable (#5071)
Browse files Browse the repository at this point in the history
  • Loading branch information
GMNGeoffrey authored Mar 11, 2021
1 parent c05dd63 commit 9467a90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build_tools/bazel/enforce_glob.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ def enforce_glob(files, **kwargs):
result_dict = {k: None for k in files}
missing = [k for k in glob_result if k not in files]
extra = [k for k in files if k not in glob_result]
expected_formatted = "\n".join(['"{}",'.format(file) for file in glob_result])
fail(("Error in enforce_glob." +
"\nExpected {}." +
"\nGot {}." +
"\nMissing {}." +
"\nExtra {}").format(glob_result, files, missing, extra))
"\nExtra {}" +
"\nPaste this into the first enforce_glob argument:" +
"\n{}").format(
glob_result,
files,
missing,
extra,
expected_formatted,
))
return files

0 comments on commit 9467a90

Please sign in to comment.