Compare commits

...

6 commits

Author SHA1 Message Date
diana-jung
702215dc79
Merge 7b9e8bff3b into bf5da9a9fb 2025-12-10 14:59:57 +05:30
Hussam.lawen
bf5da9a9fb
docs: add configuration options for ticket analysis review in compliance tool
Some checks failed
Build-and-test / build-and-test (push) Has been cancelled
docs-ci / deploy (push) Has been cancelled
2025-12-10 10:48:55 +02:00
diana-jung
7b9e8bff3b
chore: Recover the original inline code logic 2025-11-26 18:07:25 +09:00
diana-jung
d80e229bdf
implementation: Remove the duplicate filtering logic
Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com>
2025-11-26 18:04:09 +09:00
diana-jung
1315fa651b
Fix: decouple inline and table suggestion filtering logic
- **Refactor `run` method in `PRCodeSuggestions`**:
  - Pre-filter suggestions based on `suggestions_score_threshold` early in the process to prevent publishing low-score suggestions in any mode.
  - Separate inline and table publishing logic for better clarity and control.
  - Ensure dual publishing mode correctly displays all valid suggestions inline while filtering the summary table based on `dual_publishing_score_threshold`.
  - Fix potential issue where the progress bar or "no suggestions" message could be mishandled when no high-score suggestions exist for the table.

- **Update `push_inline_code_suggestions`**:
  - Re-verify score threshold within the function to ensure robust filtering (though pre-filtering in `run` handles this primarily now).
2025-11-26 16:56:32 +09:00
diana-jung
ab808fd114
fix: Apply suggestions_score_threshold filter to inline code suggestions in dual publishing mode
- Added score filtering to push_inline_code_suggestions
- Ensured inline suggestions are properly filtered when dual publishing is enabled
- High-importance suggestions appear in both table and inline; others only inline
2025-11-26 14:38:29 +09:00
3 changed files with 100 additions and 46 deletions

View file

@ -56,7 +56,7 @@ A `PR Code Verified` label indicates the PR code meets ticket requirements, but
-
By default, the tool will automatically validate if the PR complies with the referenced ticket.
By default, the `review` tool will automatically validate if the PR complies with the referenced ticket.
If you want to disable this feedback, add the following line to your configuration file:
```toml
@ -75,6 +75,33 @@ A `PR Code Verified` label indicates the PR code meets ticket requirements, but
the `review` tool will also validate that the PR code doesn't contain any additional content that is not related to the ticket. If it does, the PR will be labeled at best as `PR Code Verified`, and the `review` tool will provide a comment with the additional unrelated content found in the PR code.
### Compliance tool
The `compliance` tool also uses ticket context to validate that PR changes fulfill the requirements specified in linked tickets.
#### Configuration options
-
By default, the `compliance` tool will automatically validate if the PR complies with the referenced ticket.
If you want to disable ticket compliance checking in the compliance tool, add the following line to your configuration file:
```toml
[pr_compliance]
require_ticket_analysis_review=false
```
-
If you set:
```toml
[pr_compliance]
check_pr_additional_content=true
```
(default: `false`)
the `compliance` tool will also validate that the PR code doesn't contain any additional content that is not related to the ticket.
## GitHub/Gitlab Issues Integration
Qodo Merge will automatically recognize GitHub/Gitlab issues mentioned in the PR description and fetch the issue content.

View file

@ -329,6 +329,10 @@ enable_global_pr_compliance = true
???+ example "Ticket compliance options"
<table>
<tr>
<td><b>require_ticket_analysis_review</b></td>
<td>If set to true, the tool will fetch and analyze ticket context for compliance validation. Default is true.</td>
</tr>
<tr>
<td><b>enable_ticket_labels</b></td>
<td>If set to true, the tool will add ticket compliance labels to the PR. Default is false.</td>

View file

@ -123,17 +123,42 @@ class PRCodeSuggestions:
await self.publish_no_suggestions()
return
# Filter data by suggestions_score_threshold
score_threshold = max(1, int(get_settings().pr_code_suggestions.suggestions_score_threshold))
data['code_suggestions'] = [
d for d in data['code_suggestions']
if int(d.get('score', 0)) >= score_threshold
]
if not data['code_suggestions']:
await self.publish_no_suggestions()
return
# publish the suggestions
if get_settings().config.publish_output:
# If a temporary comment was published, remove it
self.git_provider.remove_initial_comment()
# Publish table summarized suggestions
if ((not get_settings().pr_code_suggestions.commitable_code_suggestions) and
self.git_provider.is_supported("gfm_markdown")):
# Logic for Inline Suggestions
dual_threshold = int(get_settings().pr_code_suggestions.dual_publishing_score_threshold)
if get_settings().pr_code_suggestions.commitable_code_suggestions or dual_threshold > 0:
await self.push_inline_code_suggestions(data)
# Logic for Table Suggestions
if self.git_provider.is_supported("gfm_markdown") and \
(not get_settings().pr_code_suggestions.commitable_code_suggestions or dual_threshold > 0):
data_for_table = data
# dual publishing mode
if dual_threshold > 0:
data_for_table = {'code_suggestions': []}
for suggestion in data['code_suggestions']:
if int(suggestion.get('score', 0)) >= dual_threshold:
data_for_table['code_suggestions'].append(suggestion)
if data_for_table['code_suggestions']:
# generate summarized suggestions
pr_body = self.generate_summarized_suggestions(data)
pr_body = self.generate_summarized_suggestions(data_for_table)
get_logger().debug(f"PR output", artifact=pr_body)
# require self-review
@ -168,14 +193,12 @@ class PRCodeSuggestions:
self.git_provider.edit_comment(self.progress_response, body=pr_body)
else:
self.git_provider.publish_comment(pr_body)
# dual publishing mode
if int(get_settings().pr_code_suggestions.dual_publishing_score_threshold) > 0:
await self.dual_publishing(data)
else:
await self.push_inline_code_suggestions(data)
if self.progress_response:
self.git_provider.remove_comment(self.progress_response)
else:
if self.progress_response and not (get_settings().pr_code_suggestions.commitable_code_suggestions or dual_threshold > 0):
self.git_provider.remove_comment(self.progress_response)
else:
get_logger().info('Code suggestions generated for PR, but not published since publish_output is False.')
pr_body = self.generate_summarized_suggestions(data)