From c74a2efdb7c69820890837ed7ee710982492cd3c Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 3 Apr 2025 17:44:01 +0300 Subject: [PATCH 1/4] Add code validation documentation for PR code suggestions --- docs/docs/core-abilities/code_validation.md | 38 +++++++++++++++++++++ docs/docs/core-abilities/index.md | 5 +-- docs/mkdocs.yml | 5 +-- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 docs/docs/core-abilities/code_validation.md diff --git a/docs/docs/core-abilities/code_validation.md b/docs/docs/core-abilities/code_validation.md new file mode 100644 index 00000000..f074324d --- /dev/null +++ b/docs/docs/core-abilities/code_validation.md @@ -0,0 +1,38 @@ +[//]: # (## Code Validation 💎) + +## Introduction +The Git environment usually represents the final stage before code enters production. Hence, Detecting bugs and issues during the review process is critical. + +The [`improve`](https://qodo-merge-docs.qodo.ai/tools/improve/) tool provides actionable code suggestions for your pull requests, aiming to help detect and fix bugs and problems. +By default, suggestions appear as a comment in a table format: + +![code_suggestions_as_comment_closed.png](https://codium.ai/images/pr_agent/code_suggestions_as_comment_closed.png){width=512} + +![code_suggestions_as_comment_open.png](https://codium.ai/images/pr_agent/code_suggestions_as_comment_open.png){width=512} + +## Validation of Code Suggestions + +Each suggestion it the table can be "applied", converting it to a committable Git code change that can be committed directly to the PR. +This approach allows fix issues without returning to your IDE for manual edits — significantly faster and more convenient. + +However, committing a suggestion in a Git environment carries more risk than in a local IDE, as you don't have the opportunity to fully run and test the code before committing. + +To balance convenience with safety, Qodo Merge implements a dual validation system for each generated code suggestion: + +1) **Localization** - Qodo Merge confirms that the suggestion's line numbers and surrounding code, as predicted by the model, actually match the repo code. This means that the model correctly identified the context and location of the code to be changed. + +2) **"Compilation"** - Using static code analysis, Qodo Merge verifies that after applying the suggestion, the file will still be valid, meaning tree-sitter syntax processing will not throw an error. This process is relevant for multiple programming languages, see [here](https://pypi.org/project/tree-sitter-languages/) for the full list of supported languages. + +When a suggestion fails to meet these validation criteria, it may still provide valuable feedback, but isn't suitable for direct application to the PR. +In such cases, Qodo Merge will omit the 'apply' checkbox and instead display: + +`[To ensure code accuracy, apply this suggestion manually]` + +## Conclusion + +The validation methods described above enhance the reliability of code suggestions and help PR authors determine which suggestions are safer to apply in the Git environment. +Of course, additional factors should be considered, such as suggestion complexity and potential code impact. + +Human judgment remains essential. After clicking 'apply', Qodo Merge still presents the 'before' and 'after' code snippets for review, allowing you to assess the changes before finalizing the commit. + +![improve](https://codium.ai/images/pr_agent/improve.png){width=512} \ No newline at end of file diff --git a/docs/docs/core-abilities/index.md b/docs/docs/core-abilities/index.md index 7a97a416..1e198292 100644 --- a/docs/docs/core-abilities/index.md +++ b/docs/docs/core-abilities/index.md @@ -7,10 +7,11 @@ Qodo Merge utilizes a variety of core abilities to provide a comprehensive and e - [Dynamic context](https://qodo-merge-docs.qodo.ai/core-abilities/dynamic_context/) - [Self-reflection](https://qodo-merge-docs.qodo.ai/core-abilities/self_reflection/) - [Impact evaluation](https://qodo-merge-docs.qodo.ai/core-abilities/impact_evaluation/) -- [Interactivity](https://qodo-merge-docs.qodo.ai/core-abilities/interactivity/) -- [Compression strategy](https://qodo-merge-docs.qodo.ai/core-abilities/compression_strategy/) - [RAG Context Enrichment](https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/) - [Static code analysis](https://qodo-merge-docs.qodo.ai/core-abilities/static_code_analysis/) +- [Compression strategy](https://qodo-merge-docs.qodo.ai/core-abilities/compression_strategy/) +- [Code validation](https://qodo-merge-docs.qodo.ai/core-abilities/code_validation/) +- [Interactivity](https://qodo-merge-docs.qodo.ai/core-abilities/interactivity/) - [Code fine-tuning benchmark](https://qodo-merge-docs.qodo.ai/finetuning_benchmark/) ## Blogs diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index eed3f0c8..ed7c3096 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -47,10 +47,11 @@ nav: - Dynamic context: 'core-abilities/dynamic_context.md' - Self-reflection: 'core-abilities/self_reflection.md' - Impact evaluation: 'core-abilities/impact_evaluation.md' - - Interactivity: 'core-abilities/interactivity.md' - - Compression strategy: 'core-abilities/compression_strategy.md' - RAG Context Enrichment: 'core-abilities/rag_context_enrichment.md' - Static code analysis: 'core-abilities/static_code_analysis.md' + - Compression strategy: 'core-abilities/compression_strategy.md' + - Code validation: 'core-abilities/code_validation.md' + - Interactivity: 'core-abilities/interactivity.md' - Code Fine-tuning Benchmark: 'finetuning_benchmark/index.md' - Chrome Extension: - Qodo Merge Chrome Extension: 'chrome-extension/index.md' From c2e61b7113a72a5163cdbdbebd0a08eb5fbd9977 Mon Sep 17 00:00:00 2001 From: Tal Date: Thu, 3 Apr 2025 17:52:06 +0300 Subject: [PATCH 2/4] Update docs/docs/core-abilities/code_validation.md Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com> --- docs/docs/core-abilities/code_validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/core-abilities/code_validation.md b/docs/docs/core-abilities/code_validation.md index f074324d..9c7a71cf 100644 --- a/docs/docs/core-abilities/code_validation.md +++ b/docs/docs/core-abilities/code_validation.md @@ -12,7 +12,7 @@ By default, suggestions appear as a comment in a table format: ## Validation of Code Suggestions -Each suggestion it the table can be "applied", converting it to a committable Git code change that can be committed directly to the PR. +Each suggestion in the table can be "applied", converting it to a committable Git code change that can be committed directly to the PR. This approach allows fix issues without returning to your IDE for manual edits — significantly faster and more convenient. However, committing a suggestion in a Git environment carries more risk than in a local IDE, as you don't have the opportunity to fully run and test the code before committing. From eac20ba0e2b9075c0b625f11a2eaaae7bd86e7b3 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 3 Apr 2025 17:52:38 +0300 Subject: [PATCH 3/4] Add code validation documentation for PR code suggestions --- docs/docs/core-abilities/code_validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/core-abilities/code_validation.md b/docs/docs/core-abilities/code_validation.md index 9c7a71cf..83d1c676 100644 --- a/docs/docs/core-abilities/code_validation.md +++ b/docs/docs/core-abilities/code_validation.md @@ -13,7 +13,7 @@ By default, suggestions appear as a comment in a table format: ## Validation of Code Suggestions Each suggestion in the table can be "applied", converting it to a committable Git code change that can be committed directly to the PR. -This approach allows fix issues without returning to your IDE for manual edits — significantly faster and more convenient. +This approach allows to fix issues without returning to your IDE for manual edits — significantly faster and more convenient. However, committing a suggestion in a Git environment carries more risk than in a local IDE, as you don't have the opportunity to fully run and test the code before committing. From 2683b78e34634e010527f5d806ead7135d8e0ef2 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Thu, 3 Apr 2025 17:54:20 +0300 Subject: [PATCH 4/4] Add code validation documentation for PR code suggestions --- docs/docs/core-abilities/code_validation.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/core-abilities/code_validation.md b/docs/docs/core-abilities/code_validation.md index 83d1c676..656fb2f4 100644 --- a/docs/docs/core-abilities/code_validation.md +++ b/docs/docs/core-abilities/code_validation.md @@ -1,5 +1,3 @@ -[//]: # (## Code Validation 💎) - ## Introduction The Git environment usually represents the final stage before code enters production. Hence, Detecting bugs and issues during the review process is critical.