File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1414from typing import Tuple , List , Optional
1515import click
1616from apio .common .apio_console import cout , cerror , cstyle
17- from apio .common .apio_styles import EMPH3 , SUCCESS , INFO
17+ from apio .common .apio_styles import EMPH3 , SUCCESS , INFO , ERROR
1818from apio .common .common_util import PROJECT_BUILD_PATH , sort_files
1919from apio .apio_context import (
2020 ApioContext ,
@@ -136,6 +136,7 @@ def cli(
136136 # -- Iterate the files and format one at a time. We could format
137137 # -- all of them at once but this way we can make the output more
138138 # -- user friendly.
139+ failures = 0
139140 for f in files :
140141 # -- Convert to a Path object.
141142 path = Path (f )
@@ -168,7 +169,16 @@ def cli(
168169 exit_code = os .system (command )
169170 if exit_code != 0 :
170171 cerror (f"Formatting of '{ f } ' failed" )
171- return exit_code
172+ failures += 1
173+
174+ # -- Report failures, if eny.
175+ if failures :
176+ cout ()
177+ cout (
178+ f"Encountered { util .plurality (failures , 'failure' )} ." ,
179+ style = ERROR ,
180+ )
181+ sys .exit (1 )
172182
173183 # -- All done ok.
174184 cout (f"Processed { util .plurality (files , 'file' )} ." , style = SUCCESS )
You can’t perform that action at this time.
0 commit comments