@@ -27,7 +27,7 @@ class Project:
2727
2828 mypy_cmd : str | None
2929 pyright_cmd : str | None
30- knot_cmd : str | None = None # TODO: remove this default
30+ ty_cmd : str | None = None # TODO: remove this default
3131 pyrefly_cmd : str | None = None # TODO: remove this default
3232 paths : list [str ] | None = None
3333
@@ -57,8 +57,8 @@ def __repr__(self) -> str:
5757 result += f", name_override={ self .name_override !r} "
5858 if self .pyright_cmd :
5959 result += f", pyright_cmd={ self .pyright_cmd !r} "
60- if self .knot_cmd :
61- result += f", knot_cmd ={ self .knot_cmd !r} "
60+ if self .ty_cmd :
61+ result += f", ty_cmd ={ self .ty_cmd !r} "
6262 if self .pyrefly_cmd :
6363 result += f", pyrefly_cmd={ self .pyrefly_cmd !r} "
6464 if self .paths :
@@ -292,21 +292,21 @@ async def run_pyright(
292292 runtime = runtime ,
293293 )
294294
295- def get_knot_cmd (self , knot : Path , additional_flags : Sequence [str ] = ()) -> str :
296- knot_cmd = self .knot_cmd
297- if knot_cmd is None :
298- knot_cmd = "{knot } check {paths}" if self .paths else "{knot } check"
299- assert "{knot }" in knot_cmd
295+ def get_ty_cmd (self , ty : Path , additional_flags : Sequence [str ] = ()) -> str :
296+ ty_cmd = self .ty_cmd
297+ if ty_cmd is None :
298+ ty_cmd = "{ty } check {paths}" if self .paths else "{ty } check"
299+ assert "{ty }" in ty_cmd
300300 if additional_flags :
301- knot_cmd += " " + " " .join (additional_flags )
301+ ty_cmd += " " + " " .join (additional_flags )
302302
303- knot_cmd = knot_cmd .format_map (_FormatMap (knot = knot , paths = self .paths ))
303+ ty_cmd = ty_cmd .format_map (_FormatMap (ty = ty , paths = self .paths ))
304304
305- knot_cmd += f" --python { quote_path (self .venv .dir )} --output-format concise"
306- return knot_cmd
305+ ty_cmd += f" --python { quote_path (self .venv .dir )} --output-format concise"
306+ return ty_cmd
307307
308- async def run_knot (
309- self , knot : Path , typeshed_dir : Path | None , prepend_path : Path | None
308+ async def run_ty (
309+ self , ty : Path , typeshed_dir : Path | None , prepend_path : Path | None
310310 ) -> TypeCheckResult :
311311 env = os .environ .copy ()
312312 additional_flags = ctx .get ().additional_flags .copy ()
@@ -318,36 +318,36 @@ async def run_knot(
318318
319319 env ["CLICOLOR_FORCE" ] = "1"
320320
321- knot_cmd = self .get_knot_cmd ( knot , additional_flags )
321+ ty_cmd = self .get_ty_cmd ( ty , additional_flags )
322322 proc , runtime = await run (
323- knot_cmd ,
323+ ty_cmd ,
324324 shell = True ,
325325 output = True ,
326326 check = False ,
327327 cwd = ctx .get ().projects_dir / self .name ,
328328 env = env ,
329329 )
330330 if ctx .get ().debug :
331- debug_print (f"{ Style .BLUE } { knot } on { self .name } took { runtime :.2f} s{ Style .RESET } " )
331+ debug_print (f"{ Style .BLUE } { ty } on { self .name } took { runtime :.2f} s{ Style .RESET } " )
332332
333333 if proc .returncode not in (0 , 1 ):
334334 debug_print (proc .stderr + proc .stdout )
335335 if proc .returncode == 2 :
336336 raise RuntimeError (
337- f"Red Knot exited with code 2 when checking { self .name !r} . This may indicate an internal problem (e.g. IO error)"
337+ f"ty exited with code 2 when checking { self .name !r} . This may indicate an internal problem (e.g. IO error)"
338338 )
339339 else :
340340 raise RuntimeError (
341- f"Red Knot did not exit with code 0, 1 or 2 when checking { self .name !r} . Panic?"
341+ f"ty did not exit with code 0, 1 or 2 when checking { self .name !r} . Panic?"
342342 )
343343
344344 output = proc .stderr + proc .stdout
345345
346346 return TypeCheckResult (
347- knot_cmd ,
347+ ty_cmd ,
348348 output = output ,
349349 success = not bool (proc .returncode ),
350- expected_success = "knot " in self .expected_success ,
350+ expected_success = "ty " in self .expected_success ,
351351 runtime = runtime ,
352352 )
353353
@@ -415,8 +415,8 @@ async def run_typechecker(
415415 return await self .run_mypy (type_checker , typeshed_dir , prepend_path )
416416 elif ctx .get ().type_checker == "pyright" :
417417 return await self .run_pyright (type_checker , typeshed_dir , prepend_path )
418- elif ctx .get ().type_checker == "knot " :
419- return await self .run_knot (type_checker , typeshed_dir , prepend_path )
418+ elif ctx .get ().type_checker == "ty " :
419+ return await self .run_ty (type_checker , typeshed_dir , prepend_path )
420420 elif ctx .get ().type_checker == "pyrefly" :
421421 return await self .run_pyrefly (type_checker , typeshed_dir , prepend_path )
422422 else :
0 commit comments