3030@app .command ("check" )
3131def check_cmd (
3232 paths : list [str ] = typer .Argument (default = None , help = "Files or directories to check." ),
33- severity : str = typer .Option ("warning" , "--severity" , "-s" , help = "Minimum severity: error or warning." ),
33+ severity : str = typer .Option (
34+ "warning" , "--severity" , "-s" , help = "Minimum severity: error or warning."
35+ ),
3436 fail_fast : bool = typer .Option (False , "--fail-fast" , help = "Stop after first error." ),
35- disable : Optional [list [str ]] = typer .Option (None , "--disable" , "-d" , help = "Rule IDs to disable." ),
37+ disable : Optional [list [str ]] = typer .Option (
38+ None , "--disable" , "-d" , help = "Rule IDs to disable."
39+ ),
3640 include_python : bool = typer .Option (
3741 False ,
3842 "--include-python" ,
@@ -96,14 +100,10 @@ def check_cmd(
96100 try :
97101 contract = Contract .from_file (effective_contract_path )
98102 except FileNotFoundError :
99- console .print (
100- f"[red]Contract file not found:[/red] { effective_contract_path } "
101- )
103+ console .print (f"[red]Contract file not found:[/red] { effective_contract_path } " )
102104 raise typer .Exit (code = 2 )
103105 except Exception as exc :
104- console .print (
105- f"[red]Failed to load contract { effective_contract_path } :[/red] { exc } "
106- )
106+ console .print (f"[red]Failed to load contract { effective_contract_path } :[/red] { exc } " )
107107 raise typer .Exit (code = 2 )
108108
109109 if changed_only :
@@ -200,12 +200,7 @@ def validate_contract_cmd(
200200
201201 column_count = sum (len (t .columns ) for t in contract .tables .values ())
202202 pk_count = sum (len (t .primary_keys ) for t in contract .tables .values ())
203- fk_count = sum (
204- 1
205- for t in contract .tables .values ()
206- for c in t .columns .values ()
207- if c .foreign_key
208- )
203+ fk_count = sum (1 for t in contract .tables .values () for c in t .columns .values () if c .foreign_key )
209204
210205 console .print (
211206 f"[green]OK[/green] { contract_path } : { table_count } tables, "
@@ -251,9 +246,7 @@ def schema_snapshot_cmd(
251246 from sql_guard import snapshot as snapshot_mod
252247
253248 try :
254- data = snapshot_mod .introspect (
255- dsn = dsn , schema = schema , include_tables = include_table
256- )
249+ data = snapshot_mod .introspect (dsn = dsn , schema = schema , include_tables = include_table )
257250 except snapshot_mod .SnapshotError as exc :
258251 console .print (f"[red]{ exc } [/red]" )
259252 raise typer .Exit (code = 2 )
@@ -264,9 +257,7 @@ def schema_snapshot_cmd(
264257 snapshot_mod .write_snapshot (data , output_path )
265258
266259 table_count = len (data .get ("tables" ) or {})
267- console .print (
268- f"[green]OK[/green] wrote { output_path } with { table_count } tables."
269- )
260+ console .print (f"[green]OK[/green] wrote { output_path } with { table_count } tables." )
270261
271262
272263@app .command ()
0 commit comments