Skip to content

Commit 94aa090

Browse files
authored
Merge pull request #1672 from qodo-ai/tr/docs52
Add code validation documentation for PR code suggestions
2 parents 1710cd4 + 2683b78 commit 94aa090

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Introduction
2+
The Git environment usually represents the final stage before code enters production. Hence, Detecting bugs and issues during the review process is critical.
3+
4+
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.
5+
By default, suggestions appear as a comment in a table format:
6+
7+
![code_suggestions_as_comment_closed.png](https://codium.ai/images/pr_agent/code_suggestions_as_comment_closed.png){width=512}
8+
9+
![code_suggestions_as_comment_open.png](https://codium.ai/images/pr_agent/code_suggestions_as_comment_open.png){width=512}
10+
11+
## Validation of Code Suggestions
12+
13+
Each suggestion in the table can be "applied", converting it to a committable Git code change that can be committed directly to the PR.
14+
This approach allows to fix issues without returning to your IDE for manual edits — significantly faster and more convenient.
15+
16+
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.
17+
18+
To balance convenience with safety, Qodo Merge implements a dual validation system for each generated code suggestion:
19+
20+
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.
21+
22+
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.
23+
24+
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.
25+
In such cases, Qodo Merge will omit the 'apply' checkbox and instead display:
26+
27+
`[To ensure code accuracy, apply this suggestion manually]`
28+
29+
## Conclusion
30+
31+
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.
32+
Of course, additional factors should be considered, such as suggestion complexity and potential code impact.
33+
34+
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.
35+
36+
![improve](https://codium.ai/images/pr_agent/improve.png){width=512}

docs/docs/core-abilities/index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ Qodo Merge utilizes a variety of core abilities to provide a comprehensive and e
77
- [Dynamic context](https://qodo-merge-docs.qodo.ai/core-abilities/dynamic_context/)
88
- [Self-reflection](https://qodo-merge-docs.qodo.ai/core-abilities/self_reflection/)
99
- [Impact evaluation](https://qodo-merge-docs.qodo.ai/core-abilities/impact_evaluation/)
10-
- [Interactivity](https://qodo-merge-docs.qodo.ai/core-abilities/interactivity/)
11-
- [Compression strategy](https://qodo-merge-docs.qodo.ai/core-abilities/compression_strategy/)
1210
- [RAG Context Enrichment](https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/)
1311
- [Static code analysis](https://qodo-merge-docs.qodo.ai/core-abilities/static_code_analysis/)
12+
- [Compression strategy](https://qodo-merge-docs.qodo.ai/core-abilities/compression_strategy/)
13+
- [Code validation](https://qodo-merge-docs.qodo.ai/core-abilities/code_validation/)
14+
- [Interactivity](https://qodo-merge-docs.qodo.ai/core-abilities/interactivity/)
1415
- [Code fine-tuning benchmark](https://qodo-merge-docs.qodo.ai/finetuning_benchmark/)
1516

1617
## Blogs

docs/mkdocs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ nav:
4747
- Dynamic context: 'core-abilities/dynamic_context.md'
4848
- Self-reflection: 'core-abilities/self_reflection.md'
4949
- Impact evaluation: 'core-abilities/impact_evaluation.md'
50-
- Interactivity: 'core-abilities/interactivity.md'
51-
- Compression strategy: 'core-abilities/compression_strategy.md'
5250
- RAG Context Enrichment: 'core-abilities/rag_context_enrichment.md'
5351
- Static code analysis: 'core-abilities/static_code_analysis.md'
52+
- Compression strategy: 'core-abilities/compression_strategy.md'
53+
- Code validation: 'core-abilities/code_validation.md'
54+
- Interactivity: 'core-abilities/interactivity.md'
5455
- Code Fine-tuning Benchmark: 'finetuning_benchmark/index.md'
5556
- Chrome Extension:
5657
- Qodo Merge Chrome Extension: 'chrome-extension/index.md'

0 commit comments

Comments
 (0)