diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index c939d67a..47531760 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -222,9 +222,15 @@ def update_settings_from_args(args): d = settings for i, v in enumerate(vals[:-1]): if i == len(vals) - 2: - d[v] = vals[-1] - logging.info(f'Updated setting {vals[:-1]} to: "{vals[-1]}"') - break + if v in d: + if type(d[v]) == bool: + d[v] = vals[-1].lower() in ("yes", "true", "t", "1") + else: + d[v] = type(d[v])(vals[-1]) + logging.info(f'Updated setting {vals[:-1]} to: "{vals[-1]}"') + break + else: + logging.error(f'Invalid setting {vals[:-1]}') else: d = d[v] except Exception as e: diff --git a/pr_agent/cli.py b/pr_agent/cli.py index 7a1130c8..b0173ace 100644 --- a/pr_agent/cli.py +++ b/pr_agent/cli.py @@ -31,7 +31,7 @@ reflect - Ask the PR author questions about the PR. update_changelog - Update the changelog based on the PR's contents. To edit any configuration parameter from 'configuration.toml', just add -config_path=. -For example: '- cli.py --pr-url=... review --pr_reviewer.extra_instructions="focus on the file: ...' +For example: '- cli.py --pr-url=... review --pr_reviewer.extra_instructions="focus on the file: ..."' """) parser.add_argument('--pr_url', type=str, help='The URL of the PR to review', required=True) parser.add_argument('command', type=str, help='The', choices=['review', 'review_pr', diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index de5b07ec..0631e8f6 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -1,11 +1,10 @@ commands_text = "> **/review [-i]**: Request a review of your Pull Request. For an incremental review, which only " \ "considers changes since the last review, include the '-i' option.\n" \ "> **/describe**: Modify the PR title and description based on the contents of the PR.\n" \ - "> **/improve**: Suggest improvements to the code in the PR. " \ - "These will be provided as pull request comments, ready to commit.\n" \ + "> **/improve**: Suggest improvements to the code in the PR. \n" \ "> **/ask \\**: Pose a question about the PR.\n\n" \ "To edit any configuration parameter from 'configuration.toml', just add -config_path=. " \ - "For example: '/review --pr_reviewer.extra_instructions=focus on the file: ...'" \ + "For example: '/review --pr_reviewer.extra_instructions=\"focus on the file: ...\"'" \ def bot_help_text(user: str): diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index c9d9f0ec..fe78cae8 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -55,22 +55,6 @@ class PRDescription: self.patches_diff = None self.prediction = None - def parse_args(self, args: List[str]) -> None: - """ - Parse the arguments passed to the PRDescription class and set the 'publish_description_as_comment' attribute accordingly. - - Args: - args: A list of arguments passed to the PRReviewer class. - - Returns: - None - """ - self.publish_description_as_comment = settings.pr_description.publish_description_as_comment - if args and len(args) >= 1: - arg = args[0] - if arg == "-c": - self.publish_description_as_comment = True - async def describe(self): """ Generates a PR description using an AI model and publishes it to the PR. @@ -86,7 +70,7 @@ class PRDescription: if settings.config.publish_output: logging.info('Pushing answer...') - if self.publish_description_as_comment: + if settings.pr_description.publish_description_as_comment: self.git_provider.publish_comment(markdown_text) else: self.git_provider.publish_description(pr_title, pr_body)