@@ -83,26 +83,39 @@ def check(ctx: click.Context, path: str) -> None:
8383 for e in config .get ("exclude" , []):
8484 ruff_args .extend (["--exclude" , e ])
8585
86- print_event ("Ruff check" )
86+ def maybe_exit (return_code : int ) -> None :
87+ if return_code != 0 :
88+ click .secho (
89+ "\n Code check failed. Run `plain fix` and/or fix issues manually." ,
90+ fg = "red" ,
91+ err = True ,
92+ )
93+ sys .exit (return_code )
94+
95+ print_event (
96+ click .style ("Ruff lint:" , bold = True ) + click .style (" ruff check" , dim = True )
97+ )
8798 result = subprocess .run (["ruff" , "check" , path , * ruff_args ])
88- if result .returncode != 0 :
89- sys .exit (result .returncode )
99+ maybe_exit (result .returncode )
90100
91- print_event ("Ruff format check" )
101+ print_event (
102+ click .style ("Ruff format:" , bold = True )
103+ + click .style (" ruff format --check" , dim = True )
104+ )
92105 result = subprocess .run (["ruff" , "format" , path , "--check" , * ruff_args ])
93- if result .returncode != 0 :
94- sys .exit (result .returncode )
106+ maybe_exit (result .returncode )
95107
96108 if config .get ("biome" , {}).get ("enabled" , True ):
97109 biome = Biome ()
98110
99111 if biome .needs_update ():
100112 ctx .invoke (install )
101113
102- print_event ("Biome check" )
114+ print_event (
115+ click .style ("Biome:" , bold = True ) + click .style (" biome check" , dim = True )
116+ )
103117 result = biome .invoke ("check" , path )
104- if result .returncode != 0 :
105- sys .exit (result .returncode )
118+ maybe_exit (result .returncode )
106119
107120
108121@without_runtime_setup
0 commit comments