@@ -134,12 +134,18 @@ def has_errors(self) -> bool:
134134 """Return True if any errors were found."""
135135 return len (self .errors ) > 0
136136
137- def print_summary (self , verbose : bool = False ):
137+ def print_summary (self , verbose : bool = False , warn_only : bool = False ):
138138 """Print a summary of the results."""
139139 print ("=" * 70 )
140140
141141 if self .errors :
142- print (f"\n ❌ Found { len (self .errors )} error(s) in { self .checked_count } file(s)" )
142+ if warn_only :
143+ print (
144+ f"\n ⚠️ Found { len (self .errors )} issue(s) in { self .checked_count } "
145+ f" file(s) (warn-only mode, not blocking)"
146+ )
147+ else :
148+ print (f"\n ❌ Found { len (self .errors )} error(s) in { self .checked_count } file(s)" )
143149 for error in self .errors :
144150 print (f"\n { error ['file' ]} " )
145151 print (f" { error ['message' ]} " )
@@ -155,8 +161,14 @@ def print_summary(self, verbose: bool = False):
155161 if not self .errors and not self .warnings :
156162 print (f"✅ All { self .checked_count } file(s) passed" )
157163
158- def exit_code (self ) -> int :
159- """Return appropriate exit code (1 for errors, 0 for success)."""
164+ def exit_code (self , warn_only : bool = False ) -> int :
165+ """Return appropriate exit code.
166+
167+ Args:
168+ warn_only: If True, always return 0 (issues are advisory).
169+ """
170+ if warn_only :
171+ return 0
160172 return 1 if self .has_errors () else 0
161173
162174
@@ -209,6 +221,22 @@ def create_base_parser(description: str) -> argparse.ArgumentParser:
209221 "--quiet" , "-q" , action = "store_true" , help = "Suppress all output except errors"
210222 )
211223
224+ # Behavior arguments
225+ behavior_group = parser .add_argument_group ("Behavior" )
226+ behavior_group .add_argument (
227+ "--warn-only" ,
228+ action = "store_true" ,
229+ help = "Report issues as warnings instead of errors (always exits 0)" ,
230+ )
231+
232+ # Positional: filenames passed by pre-commit (or manually)
233+ parser .add_argument (
234+ "files" ,
235+ nargs = "*" ,
236+ default = [],
237+ help = "Notebook files to check (passed automatically by pre-commit)" ,
238+ )
239+
212240 return parser
213241
214242
@@ -221,7 +249,9 @@ def get_notebooks_from_args(args: argparse.Namespace) -> tuple[List[Path], str]:
221249 Returns:
222250 Tuple of (list of notebook paths, mode description string)
223251 """
224- # Check if 'files' argument exists and is populated
252+ # Priority: explicit files (from pre-commit or CLI) > --all-notebooks > staged files.
253+ # When pre-commit passes filenames, they arrive as positional args and take precedence
254+ # over --all-notebooks, which is intended for standalone manual runs.
225255 if hasattr (args , "files" ) and args .files :
226256 notebooks = [Path (f ) for f in args .files if f .endswith (".ipynb" )]
227257 mode = "specified"
0 commit comments