Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2022 05:06
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Checks staged files for ambiguous constraints
import sys
if __name__ == '__main__':
arguments = sys.argv
# The first parameter is always the call to this executable "python3 check-ambiguous-references" which we can drop
ambiguous_constraints_found = False
# Searches through all of the modified files looking for the introduction of ambiguous constraints
for argument in arguments:
file = open(argument, "r")
if "ambiguous=\"YES\"" in
sys.stdout.write("Ambiguous constraints found in " + + "\n")
ambiguous_constraints_found = True
exit(1) if ambiguous_constraints_found else exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment