@@ -107,9 +107,7 @@ def __init__(self, docs_dir: str) -> None:
107107 if self .docs_dir .exists ():
108108 self .md_files = list (self .docs_dir .glob ("**/*.md" ))
109109
110- def extract_code_blocks (
111- self , file_path : Path
112- ) -> list [tuple [str , str , int ]]:
110+ def extract_code_blocks (self , file_path : Path ) -> list [tuple [str , str , int ]]:
113111 """Extract code blocks from markdown file.
114112
115113 Args:
@@ -147,9 +145,7 @@ def extract_code_blocks(
147145 # Extract language (handle cases like ```python)
148146 lang_part = stripped [3 :].strip ()
149147 # Take first part as language
150- current_lang = (
151- lang_part .split ()[0 ] if lang_part else ""
152- )
148+ current_lang = lang_part .split ()[0 ] if lang_part else ""
153149 current_code = []
154150 start_line = i
155151 else :
@@ -181,9 +177,7 @@ def extract_code_blocks(
181177
182178 return code_blocks
183179
184- def check_python_code (
185- self , code : str , file_path : Path , line_num : int
186- ) -> dict :
180+ def check_python_code (self , code : str , file_path : Path , line_num : int ) -> dict :
187181 """Check Python code syntax and imports.
188182
189183 Args:
@@ -313,9 +307,7 @@ def check_python_code(
313307 "file" : file_path ,
314308 }
315309
316- def check_bash_code (
317- self , code : str , file_path : Path , line_num : int
318- ) -> dict :
310+ def check_bash_code (self , code : str , file_path : Path , line_num : int ) -> dict :
319311 """Check bash command validity.
320312
321313 Args:
@@ -345,9 +337,7 @@ def check_bash_code(
345337 }
346338
347339 commands = [
348- c .strip ()
349- for c in code .split ("\n " )
350- if c .strip () and not c .strip ().startswith ("#" )
340+ c .strip () for c in code .split ("\n " ) if c .strip () and not c .strip ().startswith ("#" )
351341 ]
352342
353343 if not commands :
@@ -450,9 +440,7 @@ def run_check(self) -> tuple[list[dict], list[dict]]:
450440 print (f"Python blocks: { py_count } " )
451441 print (f"Bash blocks: { bash_count } " )
452442 excluded = ["python" , "bash" , "yaml" ]
453- other_count = sum (
454- v for k , v in code_stats .items () if k not in excluded
455- )
443+ other_count = sum (v for k , v in code_stats .items () if k not in excluded )
456444 print (f"YAML blocks: { yaml_count } " )
457445 print (f"Other blocks: { other_count } " )
458446 print (f"Checkable: { checked_count } " )
@@ -486,9 +474,7 @@ def main() -> int:
486474 f"Code blocks: { len (results )} " ,
487475 ]
488476
489- err_warn_count = len ([
490- r for r in results if r ["result" ].get ("status" ) in ["error" , "warning" ]
491- ])
477+ err_warn_count = len ([r for r in results if r ["result" ].get ("status" ) in ["error" , "warning" ]])
492478 report_lines .append (f"Issues found: { err_warn_count } " )
493479 report_lines .extend ([
494480 f"Processing issues: { len (issues )} " ,
@@ -537,12 +523,8 @@ def main() -> int:
537523 print (f"\n 📊 Report saved to: { report_file } " )
538524
539525 total_results = len (results )
540- error_count = len ([
541- r for r in results if r ["result" ].get ("status" ) == "error"
542- ])
543- warnings = len ([
544- r for r in results if r ["result" ].get ("status" ) == "warning"
545- ])
526+ error_count = len ([r for r in results if r ["result" ].get ("status" ) == "error" ])
527+ warnings = len ([r for r in results if r ["result" ].get ("status" ) == "warning" ])
546528
547529 print ("\n 📈 Statistics:" )
548530 print (f" - Total blocks: { total_results } " )
0 commit comments