Skip to content

Commit ad63c2d

Browse files
committed
refactor: move an error into arg parsing
1 parent 56ad762 commit ad63c2d

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎misc/just/codeql_test_run.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,16 @@ def parse_arguments():
7474
hands back, and what is sorted by shape here: a test path and a `CPUS=4` are both
7575
positionals, told apart only by how they look.
7676
"""
77-
# An empty argument can come from a caller interpolating an unset variable.
78-
args, rest = build_parser().parse_known_args()
77+
p = build_parser()
78+
args, rest = p.parse_known_args()
79+
if args.codeql in ("build", "built") and not SEMMLE_CODE:
80+
p.error(
81+
"Using `--codeql=build` or `--codeql=built` requires working "
82+
"with the internal repository"
83+
)
84+
7985
for arg in rest:
86+
# An empty argument can come from a caller interpolating an unset variable.
8087
if not arg:
8188
pass
8289
elif arg.startswith("-"):
@@ -114,13 +121,6 @@ def main():
114121
sys.argv[1:1] = args.extra_checks
115122
args = parse_arguments()
116123

117-
if not SEMMLE_CODE and args.codeql in ("build", "built"):
118-
error(
119-
"Using `--codeql=build` or `--codeql=built` requires working "
120-
"with the internal repository"
121-
)
122-
return 1
123-
124124
if not args.tests:
125125
args.tests.append(".")
126126

0 commit comments

Comments
 (0)