diff --git a/scripts/lint-style.py b/scripts/lint-style.py index 20608fb0da020..41a09fc061329 100755 --- a/scripts/lint-style.py +++ b/scripts/lint-style.py @@ -43,6 +43,7 @@ ERR_OPT = 6 # set_option ERR_AUT = 7 # malformed authors list ERR_TAC = 9 # imported Mathlib.Tactic +ERR_TAC2 = 10 # imported Lake in Mathlib ERR_IBY = 11 # isolated by ERR_DOT = 12 # isolated or low focusing dot ERR_SEM = 13 # the substring " ;" @@ -79,6 +80,8 @@ exceptions += [(ERR_ADN, path, None)] elif errno == "ERR_TAC": exceptions += [(ERR_TAC, path, None)] + elif errno == "ERR_TAC2": + exceptions += [(ERR_TAC2, path, None)] elif errno == "ERR_NUM_LIN": exceptions += [(ERR_NUM_LIN, path, extra[1])] else: @@ -312,6 +315,8 @@ def banned_import_check(lines, path): break if imports[1] in ["Mathlib.Tactic"]: errors += [(ERR_TAC, line_nr, path)] + elif imports[1] == "Lake" or imports[1].startswith("Lake."): + errors += [(ERR_TAC2, line_nr, path)] return errors, lines def isolated_by_dot_semicolon_check(lines, path): @@ -393,6 +398,8 @@ def format_errors(errors): output_message(path, line_nr, "ERR_AUT", "Authors line should look like: 'Authors: Jean Dupont, Иван Иванович Иванов'") if errno == ERR_TAC: output_message(path, line_nr, "ERR_TAC", "Files in mathlib cannot import the whole tactic folder") + if errno == ERR_TAC2: + output_message(path, line_nr, "ERR_TAC2", "In the past, importing 'Lake' in mathlib has led to dramatic slow-downs of the linter (see e.g. mathlib4#13779). Please consider carefully if this import is useful and make sure to benchmark it. If this is fine, feel free to allow this linter.") if errno == ERR_IBY: output_message(path, line_nr, "ERR_IBY", "Line is an isolated 'by'") if errno == ERR_DOT: