@@ -237,12 +237,13 @@ def check_missing_command_example(self):
237237 cmd_help = self ._loaded_help .get (cmd , None )
238238 if not cmd_help :
239239 continue
240- # parameters = cmd_help.parameters
241- # add if future parameter set required
242240 cmd_suffix = cmd .split ()[- 1 ]
243241 cmd_example_threshold = get_cmd_example_threshold (cmd_suffix , cmd_example_config )
244242 if cmd_example_threshold == 0 :
245243 continue
244+ if not hasattr (cmd_help , "parameters" ) or len (cmd_help .parameters ) == 0 :
245+ # skip cmd without parameters
246+ continue
246247 if not hasattr (cmd_help , "examples" ) or len (cmd_help .examples ) < cmd_example_threshold :
247248 violations .append (f'Command `{ cmd } ` should have at least { cmd_example_threshold } example(s)' )
248249 if violations :
@@ -427,7 +428,9 @@ def _detect_modified_command(self):
427428 modified_commands = set ()
428429 diff_patches = diff_branch_file_patch (repo = self .git_repo , target = self .git_target , source = self .git_source )
429430 for change in diff_patches :
430- file_path , filename = self ._split_path (change .a_path )
431+ if not change .b_path or not change .diff :
432+ continue
433+ file_path , filename = self ._split_path (change .b_path )
431434 if "commands.py" not in filename and "aaz" not in file_path :
432435 continue
433436 current_lines = self ._read_blob_lines (change .b_blob )
@@ -462,6 +465,8 @@ def _get_diffed_patches(self):
462465 return
463466 diff_patches = diff_branch_file_patch (repo = self .git_repo , target = self .git_target , source = self .git_source )
464467 for change in diff_patches :
468+ if not change .diff :
469+ continue
465470 patch = change .diff .decode ("utf-8" )
466471 added_lines = [line for line in patch .splitlines () if line .startswith ('+' ) and not line .startswith ('+++' )]
467472 self .diffed_lines |= set (added_lines )
0 commit comments