diff --git a/README.md b/README.md index 33c1b763..b5668a6a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull \ **Code Suggestion**: Committable code suggestions for improving the PR. +**Update Changelog**: Automatically updating the CHANGELOG.md file with the PR changes. +

Example results:

/describe:

@@ -135,13 +137,14 @@ There are several ways to use PR-Agent: ## Usage and Tools -**PR-Agent** provides five types of interactions ("tools"): `"PR Reviewer"`, `"PR Q&A"`, `"PR Description"`, `"PR Code Sueggestions"` and `"PR Reflect and Review"`. +**PR-Agent** provides six types of interactions ("tools"): `"PR Reviewer"`, `"PR Q&A"`, `"PR Description"`, `"PR Code Sueggestions"`, `"PR Reflect and Review"` and `"PR Update Changlog"`. - The "PR Reviewer" tool automatically analyzes PRs, and provides various types of feedback. - The "PR Q&A" tool answers free-text questions about the PR. - The "PR Description" tool automatically sets the PR Title and body. - The "PR Code Suggestion" tool provide inline code suggestions for the PR that can be applied and committed. - The "PR Reflect and Review" tool initiates a dialog with the user, asks them to reflect on the PR, and then provides a more focused review. +- The "PR Update Changelog" tool automatically updates the CHANGELOG.md file with the PR changes. ## How it works @@ -158,7 +161,7 @@ Here are some of the reasons why: - We emphasize **real-life practical usage**. Each tool (review, improve, ask, ...) has a single GPT-4 call, no more. We feel that this is critical for realistic team usage - obtaining an answer quickly (~30 seconds) and affordably. - Our [PR Compression strategy](./PR_COMPRESSION.md) is a core ability that enables to effectively tackle both short and long PRs. - Our JSON prompting strategy enables to have **modular, customizable tools**. For example, the '/review' tool categories can be controlled via the configuration file. Adding additional categories is easy and accessible. -- We support **multiple git providers** (GitHub, Gitlab, Bitbucket), and multiple ways to use the tool (CLI, GitHub Action, Docker, ...). +- We support **multiple git providers** (GitHub, Gitlab, Bitbucket), and multiple ways to use the tool (CLI, GitHub Action, GitHub App, Docker, ...). - We are open-source, and welcome contributions from the community. diff --git a/tests/unit/test_convert_to_markdown.py b/tests/unittest/test_convert_to_markdown.py similarity index 100% rename from tests/unit/test_convert_to_markdown.py rename to tests/unittest/test_convert_to_markdown.py diff --git a/tests/unit/test_delete_hunks.py b/tests/unittest/test_delete_hunks.py similarity index 100% rename from tests/unit/test_delete_hunks.py rename to tests/unittest/test_delete_hunks.py diff --git a/tests/unit/test_extend_patch.py b/tests/unittest/test_extend_patch.py similarity index 100% rename from tests/unit/test_extend_patch.py rename to tests/unittest/test_extend_patch.py diff --git a/tests/unit/test_fix_output.py b/tests/unittest/test_fix_output.py similarity index 100% rename from tests/unit/test_fix_output.py rename to tests/unittest/test_fix_output.py diff --git a/tests/unit/test_handle_patch_deletions.py b/tests/unittest/test_handle_patch_deletions.py similarity index 100% rename from tests/unit/test_handle_patch_deletions.py rename to tests/unittest/test_handle_patch_deletions.py diff --git a/tests/unit/test_language_handler.py b/tests/unittest/test_language_handler.py similarity index 100% rename from tests/unit/test_language_handler.py rename to tests/unittest/test_language_handler.py diff --git a/tests/unit/test_parse_code_suggestion.py b/tests/unittest/test_parse_code_suggestion.py similarity index 100% rename from tests/unit/test_parse_code_suggestion.py rename to tests/unittest/test_parse_code_suggestion.py diff --git a/tests/unittest/test_update_settings_from_args.py b/tests/unittest/test_update_settings_from_args.py new file mode 100644 index 00000000..5cfa2202 --- /dev/null +++ b/tests/unittest/test_update_settings_from_args.py @@ -0,0 +1,50 @@ + +# Generated by CodiumAI +from pr_agent.algo.utils import update_settings_from_args +import logging +from pr_agent.config_loader import settings + + +import pytest + +class TestUpdateSettingsFromArgs: + # Tests that the function updates the setting when passed a single valid argument. + def test_single_valid_argument(self): + args = ['--pr_code_suggestions.extra_instructions="be funny"'] + update_settings_from_args(args) + assert settings.pr_code_suggestions.extra_instructions == '"be funny"' + + # Tests that the function updates the settings when passed multiple valid arguments. + def test_multiple_valid_arguments(self): + args = ['--pr_code_suggestions.extra_instructions="be funny"', '--pr_code_suggestions.num_code_suggestions=3'] + update_settings_from_args(args) + assert settings.pr_code_suggestions.extra_instructions == '"be funny"' + assert settings.pr_code_suggestions.num_code_suggestions == 3 + + # Tests that the function updates the setting when passed a boolean value. + def test_boolean_values(self): + settings.pr_code_suggestions.enabled = False + args = ['--pr_code_suggestions.enabled=true'] + update_settings_from_args(args) + assert 'pr_code_suggestions' in settings + assert 'enabled' in settings.pr_code_suggestions + assert settings.pr_code_suggestions.enabled == True + + # Tests that the function updates the setting when passed an integer value. + def test_integer_values(self): + args = ['--pr_code_suggestions.num_code_suggestions=3'] + update_settings_from_args(args) + assert settings.pr_code_suggestions.num_code_suggestions == 3 + + # Tests that the function does not update any settings when passed an empty argument list. + def test_empty_argument_list(self): + args = [] + update_settings_from_args(args) + assert settings == settings + + # Tests that the function logs an error when passed an invalid argument format. + def test_invalid_argument_format(self, caplog): + args = ['--pr_code_suggestions.extra_instructions="be funny"', '--pr_code_suggestions.num_code_suggestions'] + with caplog.at_level(logging.ERROR): + update_settings_from_args(args) + assert 'Invalid argument format' in caplog.text \ No newline at end of file