@@ -337,44 +337,39 @@ def add_comment(self, body: str) -> None:
337337 pass
338338
339339 def run (self ) -> TaskResults :
340- if self .comment .startswith ("/packit-ci-stg" ): # type: ignore
341- parser = get_comment_parser_fedora_ci (
342- prog = HELP_COMMENT_PROG_FEDORA_CI_STG ,
343- description = HELP_COMMENT_DESCRIPTION ,
344- )
345- epilog = HELP_COMMENT_EPILOG .format (
346- note = self .get_epilog_note_fedora_ci (), docs_url = DOCS_URL_FEDORA_CI
347- )
348-
349- elif self .comment .startswith ("/packit-ci" ): # type: ignore
350- parser = get_comment_parser_fedora_ci (
351- prog = HELP_COMMENT_PROG_FEDORA_CI ,
352- description = HELP_COMMENT_DESCRIPTION ,
353- )
354- epilog = HELP_COMMENT_EPILOG .format (
355- note = self .get_epilog_note_fedora_ci (), docs_url = DOCS_URL_FEDORA_CI
356- )
357-
358- elif self .comment .startswith ("/packit-stg" ): # type: ignore
359- parser = get_comment_parser (
360- prog = HELP_COMMENT_PROG_STG ,
361- description = HELP_COMMENT_DESCRIPTION ,
362- )
363-
364- epilog = HELP_COMMENT_EPILOG .format (note = self .get_epilog_note (), docs_url = DOCS_URL )
365-
340+ # Determine parameters based on comment prefix
341+ comment = self .comment
342+
343+ if comment .startswith ("/packit-ci-stg" ): # type: ignore
344+ prog = HELP_COMMENT_PROG_FEDORA_CI_STG
345+ parser_func = get_comment_parser_fedora_ci
346+ epilog_note = self .get_epilog_note_fedora_ci ()
347+ docs_url = DOCS_URL_FEDORA_CI
348+ elif comment .startswith ("/packit-ci" ): # type: ignore
349+ prog = HELP_COMMENT_PROG_FEDORA_CI
350+ parser_func = get_comment_parser_fedora_ci
351+ epilog_note = self .get_epilog_note_fedora_ci ()
352+ docs_url = DOCS_URL_FEDORA_CI
353+ elif comment .startswith ("/packit-stg" ): # type: ignore
354+ prog = HELP_COMMENT_PROG_STG
355+ parser_func = get_comment_parser # type: ignore[assignment]
356+ epilog_note = self .get_epilog_note ()
357+ docs_url = DOCS_URL
366358 else :
367- parser = get_comment_parser (
368- prog = HELP_COMMENT_PROG ,
369- description = HELP_COMMENT_DESCRIPTION ,
370- )
359+ prog = HELP_COMMENT_PROG
360+ parser_func = get_comment_parser # type: ignore[assignment]
361+ epilog_note = self . get_epilog_note ()
362+ docs_url = DOCS_URL
371363
372- epilog = HELP_COMMENT_EPILOG .format (note = self .get_epilog_note (), docs_url = DOCS_URL )
364+ # Use determined parameters to create parser and epilog
365+ parser = parser_func (prog = prog , description = HELP_COMMENT_DESCRIPTION )
366+ epilog = HELP_COMMENT_EPILOG .format (note = epilog_note , docs_url = docs_url )
373367
368+ # Format and comment help message
374369 body = break_lines_in_text (
375370 parser .format_help (), sep = "," , max_line_length = COMMENT_MAX_LINE_LENGTH
376371 )
377- # put message in code block to retain formatting
372+ # Put body in code block to retain formatting
378373 help_message = f"```\n { body } \n ```\n { epilog } "
379374 self .add_comment (body = help_message )
380375
0 commit comments