repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -10,7 +11,10 @@ import * as tokenizer from './tokenizer.js'
const token = core.getInput('token')
? core.getInput('token')
: process.env.GITHUB_TOKEN | :robot: OpenAI
The code change looks good. However, it would be better to use the `||` operator instead of ternary operator for better readability.
```suggestion
const token = core.getInput('token') || process.env.GITHUB_TOKEN;
```
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -10,7 +11,10 @@ import * as tokenizer from './tokenizer.js'
const token = core.getInput('token')
? core.getInput('token')
: process.env.GITHUB_TOKEN
-const octokit = new Octokit({auth: `token ${token}`})
+
+const RetryOctokit = Octokit.plugin(retry)
+const octokit = new RetryOctokit({auth: `token ${token}`}) | :robot: OpenAI
The `RetryOctokit` class is created by adding the `retry` plugin to the `Octokit` class. This is a good approach to add retry functionality to the `Octokit` instance. However, it would be better to move this code to a separate function or module so that it can be reused in other parts of the codebase.
... |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -127,11 +131,10 @@ export const codeReview = async (
continue
}
const hunks_str = `
-\`\`\`new_hunk
+\`\`\`new_hunk_for_review
${hunks.new_hunk}
\`\`\`
-
-\`\`\`old_hunk
+\`\`\`old_hunk_for_context
${hunks.old_hunk}
\`\`\`
` | :robot: OpenAI
The `hunks_str` variable is created by concatenating multiple strings. This can be error-prone and hard to read. It would be better to use template literals instead of string concatenation.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -272,6 +275,10 @@ ${filename}: ${summary}
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
+### Code suggestions
+- The bot will sometimes make code suggestion... | :robot: OpenAI
The changes look good. However, it would be better to use bullet points for better readability.
```suggestion
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -2,12 +2,13 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import {Octokit} from '@octokit/action'
-import {ChatGPTError} from 'chatgpt'
+import {retry} from '@octokit/plugin-retry' | :robot: OpenAI
The addition of the `@octokit/plugin-retry` plugin is a good improvement to handle failed requests. However, it's important to note that this plugin may introduce data consistency issues if not handled properly. Please ensure that the retry plugin is used only for idempotent operations or that you have ... |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -534,10 +532,8 @@ ${chain}
this.issueCommentsCache[target] = all_comments
return all_comments
- } catch (e: unknown) {
- if (e instanceof ChatGPTError) {
- core.warning(`Failed to list comments: ${e}`)
- }
+ } catch (e: any) {
+ core.warning(`Failed to list comments: ${e}`... | :robot: OpenAI
Good job on improving error handling. However, please consider catching specific errors instead of using `any`. This will help with debugging and make the code more maintainable.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -15,7 +16,9 @@ const token = core.getInput('token')
? core.getInput('token')
: process.env.GITHUB_TOKEN
-const octokit = new Octokit({auth: `token ${token}`})
+const RetryOctokit = Octokit.plugin(retry)
+const octokit = new RetryOctokit({auth: `token ${token}`}) | :robot: OpenAI
The addition of the retry plugin is a good improvement to handle failed requests. However, it would be better to use a new `RetryOctokit` instance instead of modifying the existing `octokit` instance. This will ensure that the retry plugin is only used when necessary and does not affect other parts of t... |
ai-pr-reviewer | github_2023 | others | 146 | coderabbitai | github-actions[bot] | @@ -29,6 +29,7 @@
"@actions/github": "^5.1.1",
"@dqbd/tiktoken": "^1.0.2",
"@octokit/action": "^5.0.2",
+ "@octokit/plugin-retry": "^4.1.3", | :robot: OpenAI
The addition of `@octokit/plugin-retry` as a dependency may introduce data consistency issues if not handled properly. Please ensure that the retry plugin is used in a way that does not compromise data consistency.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 146 | coderabbitai | github-actions[bot] | @@ -29,6 +29,7 @@
"@actions/github": "^5.1.1",
"@dqbd/tiktoken": "^1.0.2",
"@octokit/action": "^5.0.2", | :robot: OpenAI
Please update the description for the existing input to reflect the new changes.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -1,6 +1,7 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import {Octokit} from '@octokit/action' | :robot: OpenAI
The changes look good. However, it would be better to add a comment explaining why the `Octokit` instance is being replaced with a `RetryOctokit` instance. This will help future developers understand the code better.
```suggestion
// Replace Octokit instance with RetryOctokit instance to enable retryin... |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -272,6 +275,10 @@ ${filename}: ${summary}
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging \`@openai\` in a reply.
+### Code suggestions
+- The bot may make code suggestions, but plea... | :robot: OpenAI
The text in this section is not very clear. It would be better to provide more detailed instructions on how to use the bot's code suggestions feature.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -400,7 +407,7 @@ ${
let comment_chain = ''
try {
- const all_chains = await commenter.get_conversation_chains_within_range(
+ const all_chains = await commenter.get_comment_chains_within_range(
context.payload.pull_request.number,
filename,
start_line, | :robot: OpenAI
The `get_comment_chains_within_range` function is called with four arguments. The last three arguments are related to the range of lines where the comment chains should be retrieved. It would be better to group these arguments into an object or a tuple to make the function call more readable.
<!-- This... |
ai-pr-reviewer | github_2023 | typescript | 146 | coderabbitai | github-actions[bot] | @@ -434,7 +441,7 @@ ${patch}
`
if (comment_chain !== '') {
ins.patches += `
-\`\`\`comment_chain
+\`\`\`comment_chains_for_review
${comment_chain}
\`\`\`
` | :robot: OpenAI
The `patches` variable is updated by concatenating multiple strings. This can be error-prone and hard to read. It would be better to use template literals instead of string concatenation.
That's all for my review. Let me know if you have any questions or concerns.
<!-- This is an auto-generated commen... |
ai-pr-reviewer | github_2023 | others | 144 | coderabbitai | github-actions[bot] | @@ -0,0 +1,13 @@
+name: Tag latest
+
+on:
+ release:
+ types: [published, edited]
+
+jobs:
+ actions-tagger:
+ runs-on: windows-latest
+ steps:
+ - uses: Actions-R-Us/actions-tagger@latest
+ with:
+ publish_latest_tag: true | :robot: OpenAI
This workflow file adds a new job that runs on release events and tags the latest commit using an external action. However, there is no error handling in case the external action fails. It's important to add proper error handling to ensure that the workflow doesn't fail silently. Additionally, it's reco... |
ai-pr-reviewer | github_2023 | others | 141 | coderabbitai | github-actions[bot] | @@ -200,7 +200,7 @@ inputs:
Don't echo back the code provided to you as the
line number range is sufficient to map your comment to the relevant code
section in GitHub. Markdown format is preferred for text. Fenced code
- blocks should be used for complete code suggestions that replace code ... | :robot: OpenAI
The sentence "It's important that the code suggestions are complete, correctly formatted and without line number annotations so that they can be committed as-is." is a bit confusing. Can you rephrase it to make it clearer?
<!-- This is an auto-generated reply by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 141 | coderabbitai | github-actions[bot] | @@ -214,6 +214,11 @@ inputs:
<start_line_number>-<end_line_number>:
<review markdown>
---
+ <start_line_number>-<end_line_number>:
+ <review markdown>
+ ```<language>
+ <new code suggestion>
+ ```
...
| :robot: OpenAI
It would be helpful to provide some examples of how to use the new guidelines in practice. Could you please add some examples to the documentation?
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 141 | coderabbitai | github-actions[bot] | @@ -200,10 +200,10 @@ inputs:
Don't echo back the code provided to you as the
line number range is sufficient to map your comment to the relevant code
section in GitHub. Markdown format is preferred for text. Fenced code
- blocks should be used for complete code suggestions that replace cod... | :robot: OpenAI
I suggest rephrasing this section to make it clearer that fenced code blocks should be used only for new or replacement code suggestions, not for all code comments. Also, it would be helpful to provide an example of a correctly formatted fenced code block.
<!-- This is an auto-generated comment by Open... |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -457,8 +456,8 @@ ${comment_chain}
return
}
// parse review
- const reviewMap = parseOpenAIReview(response, options.debug)
- for (const [, review] of reviewMap) {
+ const reviews = parseReview(response, options.debug)
+ for (const review of reviews) {
// check for L... | :robot: OpenAI
The `parseReview` function seems to be parsing OpenAI reviews, but the function name doesn't reflect that. It might be better to rename it to `parseOpenAIReview` or something similar.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -671,9 +668,9 @@ function parseOpenAIReview(
const lineNumberRangeMatch = line.match(lineNumberRangeRegex)
if (lineNumberRangeMatch) {
- // If there is a previous comment, store it in the reviews Map
+ // If there is a previous comment, store it in the reviews
if (currentStartLine !== nu... | :robot: OpenAI
In the `parseReview` function, the `reviews` array is being used to store objects with `start_line`, `end_line`, and `comment` properties. However, this information can be better represented using a map where the key is a string in the format `<start_line>-<end_line>` and the value is the object with `s... |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -156,7 +156,7 @@ ${tag}`
for (const comment of comments) {
if (comment.body.includes(tag)) {
core.info(
- `Updating review comment for ${path}:${end_line}: ${message}`
+ `Updating review comment for ${path}:${start_line}-${end_line}: ${message}`
)
... | :robot: OpenAI
The `core.info` message in line 158 should be updated to include the `start_line` and `end_line` variables instead of just `end_line`. This will make it easier to identify which comment is being updated.
```suggestion
core.info(
`Updating review comment for ${path}:${start_line}-${end_line}: ${messa... |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -279,14 +279,32 @@ ${COMMENT_REPLY_TAG}
)
}
- async get_conversation_chains_at_range(
+ async get_comments_at_range(
+ pull_number: number,
+ path: string,
+ start_line: number,
+ end_line: number
+ ) {
+ const comments = await this.list_review_comments(pull_number)
+ return comments.f... | :robot: OpenAI
The function `get_comments_at_range` in line 282 should be renamed to `get_comments_within_range` to match the new function name in line 264. Additionally, the new function `get_conversation_chains_within_range` in lines 300-306 should be added to retrieve all conversation chains within a given range.
... |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -279,14 +279,32 @@ ${COMMENT_REPLY_TAG}
)
}
- async get_conversation_chains_at_range(
+ async get_comments_at_range(
+ pull_number: number,
+ path: string,
+ start_line: number,
+ end_line: number
+ ) {
+ const comments = await this.list_review_comments(pull_number)
+ return comments.f... | :robot: OpenAI
The function name `get_conversation_chains_at_range` has been changed to `get_conversation_chains_within_range`. However, the function signature still uses the old name. It should be updated to reflect the new name.
```suggestion
300: async get_conversation_chains_within_range(
301: pull_number:... |
ai-pr-reviewer | github_2023 | others | 140 | coderabbitai | github-actions[bot] | @@ -202,8 +202,8 @@ inputs:
section in GitHub. Markdown format is preferred for text. Fenced code
blocks should be used for complete code suggestions that replace code
at those exact line number ranges. It's important that the code
- suggestions are complete and correctly formatted so that ... | :robot: OpenAI
It's important to note that the suggestion in this hunk is incomplete. It mentions that fenced code blocks should be used for complete code suggestions, but it doesn't actually provide an example of what a complete code suggestion would look like. It might be helpful to add an example here to clarify.
... |
ai-pr-reviewer | github_2023 | others | 140 | coderabbitai | github-actions[bot] | @@ -202,8 +202,8 @@ inputs:
section in GitHub. Markdown format is preferred for text. Fenced code
blocks should be used for complete code suggestions that replace code
at those exact line number ranges. It's important that the code
- suggestions are complete and correctly formatted so that ... | :robot: OpenAI
```suggestion
207: section in GitHub. Markdown format is preferred for text. Fenced code
208: blocks should be used for complete code suggestions that replace code
209: at those exact line number ranges. It's important that the code
```
This suggestion adds an example of a comple... |
ai-pr-reviewer | github_2023 | typescript | 140 | coderabbitai | github-actions[bot] | @@ -261,7 +261,7 @@ ${COMMENT_REPLY_TAG}
}
}
- async get_comments_at_range(
+ async get_comments_within_range(
pull_number: number,
path: string,
start_line: number, | :robot: OpenAI
The function name `get_comments_at_range` in line 264 should be changed to `get_comments_within_range` to better reflect its functionality.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 138 | coderabbitai | github-actions[bot] | @@ -1,7 +1,6 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import {Octokit} from '@octokit/action'
-import {ChatGPTError} from 'chatgpt'
import pLimit from 'p-limit'
import {Bot} from './bot.js' | :robot: OpenAI
It would be helpful to provide a description of the changes made in the pull request description.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 138 | coderabbitai | github-actions[bot] | @@ -415,12 +414,10 @@ ${
} else {
comment_chain = ''
}
- } catch (e: unknown) {
- if (e instanceof ChatGPTError) {
- core.warning(
- `Failed to get comments: ${e}, skipping. backtrace: ${e.stack}`
- )
- }
+ } catch (e: any) {
+ cor... | :robot: OpenAI
In the try-catch block, it is catching all exceptions with `any`. It would be better to catch specific exceptions instead of using `any`.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -143,7 +143,6 @@ export class TokenLimits {
max_tokens: number
request_tokens: number
response_tokens: number
- extra_content_tokens: number
constructor(model = 'gpt-3.5-turbo') {
if (model === 'gpt-4-32k') { | :robot: OpenAI
The `model` parameter in the constructor is not used. Is it necessary to have it as a parameter? If not, it can be removed to simplify the code.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -134,11 +134,20 @@ export const handleReviewComment = async (
inputs.summary = summary.body
}
+ // get tokens so far
+ let tokens = tokenizer.get_token_count(prompts.render_comment(inputs))
+
+ // pack file content and diff into the inputs if they are not too long
if (file_con... | :robot: OpenAI
The changes made in this hunk pack file content and diff into the inputs if they are not too long. The new code counts the occurrences of `$file_content` and `$file_diff` in the prompt and limits the number of tokens to `options.heavy_token_limits.request_tokens`. This is a good improvement as it allows... |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -148,10 +157,15 @@ export const handleReviewComment = async (
if (inputs.diff.length === 0) {
inputs.diff = file_diff
}
+ // count occurrences of $file_diff in prompt
+ const file_diff_count =
+ prompts.summarize_file_diff.split('$file_diff').length - 1
co... | :robot: OpenAI
This hunk also packs file diff into the inputs if it's not too long. Similar to the previous hunk, the new code counts the occurrences of `$file_diff` in the prompt and limits the number of tokens to `options.heavy_token_limits.request_tokens`. Again, this is a good improvement, but I suggest adding err... |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -162,49 +162,57 @@ ${hunks.old_hunk}
file_diff: string
): Promise<[string, string] | null> => {
const ins = inputs.clone()
+ if (file_diff.length === 0) {
+ core.warning(`summarize: file_diff is empty, skip ${filename}`)
+ return null
+ }
+
ins.filename = filename
+ ... | :robot: OpenAI
The changes made in this hunk look good to me. However, I noticed that the `file contents cannot be provided` message is still present in line 164. Is it intentional? If not, it should be removed.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
| :robot: OpenAI
It seems like the `files_to_review` variable is not being used anymore. Is it safe to remove this code block?
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
- if (files_to_review.length > 0) {
- const generateSummary = async (
- filename: string,
- file_content: string,
- file_diff: string
- ): Promise<[string, string] ... | :robot: OpenAI
It would be helpful to log a warning message when there are no files to review, so that users can quickly identify if something went wrong.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -203,6 +203,8 @@ ${tag}`
core.warning(
`Failed to post review comment, for ${path}:${start_line}-${end_line}: ${e}`
)
+ // throw error
+ throw e
} | :robot: OpenAI
It's generally not a good idea to throw an error in the catch block as it can lead to unexpected behavior. Instead, you should log the error and handle it gracefully. You can remove line 207 and replace lines 203-206 with the following code:
```suggestion
203: core.warning(
204: `Failed... |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
- if (files_to_review.length > 0) {
- const generateSummary = async (
- filename: string,
- file_content: string,
- file_diff: string
- ): Promise<[string, string] ... | :robot: OpenAI
The `do_summary` function has been updated to include file content and diff in the inputs if they are not too long. However, it seems like the check for file_content.length > 0 on line 193 is redundant since it is already checked on line 182.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
- if (files_to_review.length > 0) {
- const generateSummary = async (
- filename: string,
- file_content: string,
- file_diff: string
- ): Promise<[string, string] ... | :robot: OpenAI
It might be better to throw an error instead of returning null when the diff tokens exceed the limit. This way, the user can be notified immediately that there was an issue with the input.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
- if (files_to_review.length > 0) {
- const generateSummary = async (
- filename: string,
- file_content: string,
- file_diff: string
- ): Promise<[string, string] ... | :robot: OpenAI
The logic for packing file content could be simplified by using a single if statement instead of nesting another if statement inside.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 137 | coderabbitai | github-actions[bot] | @@ -155,100 +155,117 @@ ${hunks.old_hunk}
file => file !== null
) as [string, string, string, [number, number, string][]][]
- if (files_to_review.length > 0) {
- const generateSummary = async (
- filename: string,
- file_content: string,
- file_diff: string
- ): Promise<[string, string] ... | :robot: OpenAI
Instead of filtering out null values from the summaries array, it might be better to use Promise.allSettled() to ensure that all promises are resolved before continuing. This way, any errors that occur during the promise chain will be caught and logged.
<!-- This is an auto-generated comment by OpenAI ... |
ai-pr-reviewer | github_2023 | typescript | 134 | coderabbitai | github-actions[bot] | @@ -256,7 +270,7 @@ ${COMMENT_REPLY_TAG}
(comment: any) =>
comment.path === path &&
comment.body !== '' &&
- ((comment.start_line &&
+ ((comment.start_line !== undefined &&
comment.start_line >= start_line &&
comment.line <= end_line) ||
comment.li... | :robot: OpenAI
In the changes made to the `commenter.ts` file, there is a typo in line 274. It should be `comment.line <= end_line` instead of `comment.line <= end_line)`. This could cause issues with the logic of the code.
Overall, the changes made to the codebase are good and improve the code review process. Howeve... |
ai-pr-reviewer | github_2023 | typescript | 134 | coderabbitai | github-actions[bot] | @@ -173,17 +173,31 @@ ${tag}`
core.info(
`Creating new review comment for ${path}:${start_line}-${end_line}: ${message}`
)
- await octokit.pulls.createReviewComment({
- owner: repo.owner,
- repo: repo.repo,
- pull_number,
- body: message,
- ... | :robot: OpenAI
The changes made to the `commenter.ts` file look good. The code now creates either a single-line or multi-line comment based on the start and end lines of the code changes. This will make it easier for reviewers to leave comments on specific lines of code.
<!-- This is an auto-generated comment by Open... |
ai-pr-reviewer | github_2023 | others | 133 | coderabbitai | github-actions[bot] | @@ -200,14 +200,10 @@ inputs:
LGTM!
---
- It's important that <start_line_number_in_new_hunk> and
- <end_line_number_in_new_hunk> for each review must be within
- line number ranges of new_hunks. Don't echo back the
+ It's important that line number ranges for each review must
+ ... | :robot: OpenAI
The updated instructions emphasize the importance of providing specific line number ranges for each review and suggest using Markdown format for text and fenced code blocks for code suggestions. This is a good practice as it helps reviewers to quickly locate the relevant code sections and understand the... |
ai-pr-reviewer | github_2023 | others | 133 | coderabbitai | github-actions[bot] | @@ -200,14 +200,10 @@ inputs:
LGTM!
---
- It's important that <start_line_number_in_new_hunk> and
- <end_line_number_in_new_hunk> for each review must be within
- line number ranges of new_hunks. Don't echo back the
+ It's important that line number ranges for each review must
+ ... | :robot: OpenAI
It's great to see that the instructions encourage reviewers to reflect on the provided code at least three times and identify any bug risks or provide improvement suggestions in these changes. This will help ensure that the code changes are thoroughly reviewed and any potential issues are identified and... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -253,8 +253,8 @@ ${COMMENT_REPLY_TAG}
return comments.filter(
(comment: any) =>
comment.path === path &&
- comment.start_line === start_line &&
- comment.line === end_line &&
+ comment.start_line >= start_line &&
+ comment.line <= end_line && | :robot: OpenAI
The new code in this hunk is also an improvement over the old one. It now filters comments based on a range of start and end lines instead of just a single line number. This will make the filtering more accurate. Great work!
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,28 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The changes made here seem reasonable. The new code adds the ability to parse hunks and include old and new code hunks with line numbers in the review comments. This should make it easier for reviewers to understand the changes being made.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,28 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The changes made in this hunk seem to be adding a new function `parse_hunk` which parses the hunks and includes them in patches. The code also skips sending comment chains if they exceed token limits. However, I noticed that the condition on line 123 has been changed from checking if `patch_lines.start_... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -348,6 +372,17 @@ ${
} else {
comment_chain = ''
}
+ // check comment_chain tokens and skip if too long
+ const comment_chain_tokens = tokenizer.get_token_count(comment_chain)
+ if (
+ comment_chain_tokens >
+ options.heavy_token_lim... | :robot: OpenAI
The changes made in this hunk seem reasonable. The code now includes the `comment_chain` in the patches and checks the token count of `comment_chain` before sending it. This will make it easier for reviewers to see the existing review comments in the context of the changes. However, I noticed that the v... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -356,10 +391,7 @@ ${
}
}
ins.patches += `
-${start_line}-${end_line}:
-\`\`\`diff
${patch}
-\`\`\`
`
if (comment_chain !== '') {
ins.patches += ` | :robot: OpenAI
In the `send_review_comment` function, you are appending the `comment_chain` string to the `ins.patches` string. However, it's not clear what the purpose of the `ins.patches` string is or how it's being used. Can you provide some comments or documentation to explain its usage?
<!-- This is an auto-gene... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -484,21 +516,74 @@ const split_patch = (patch: string | null | undefined): string[] => {
const patch_start_end_line = (
patch: string
-): {start_line: number; end_line: number} | null => {
+): {
+ old_hunk: {start_line: number; end_line: number}
+ new_hunk: {start_line: number; end_line: number}
+} | null =>... | :robot: OpenAI
The `parse_hunk` function is overly complex and could be simplified. Specifically, the logic for handling added and removed lines can be combined into a single loop. Additionally, the `Review` type is defined but never used.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -171,7 +171,7 @@ ${tag}`
if (!found) {
core.info(
- `Creating new review comment for ${path}:${end_line}: ${message}`
+ `Creating new review comment for ${path}:${start_line}-${end_line}: ${message}`
) | :robot: OpenAI
The `try-catch` block in this function is not handling errors properly. If an error occurs while creating a new review comment, the catch block only logs the error message as a warning and continues with the execution of the function. This can lead to unexpected behavior and make it difficult to debug i... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -186,7 +186,9 @@ ${tag}`
})
}
} catch (e) {
- core.warning(`Failed to post review comment: ${e}`)
+ core.warning(
+ `Failed to post review comment, for ${path}:${start_line}-${end_line}: ${e}`
+ )
} | :robot: OpenAI
In the same `createReviewComment` function, the catch block logs a warning message when it fails to post a review comment. However, the warning message only includes the error message and not the path or line numbers that the comment was supposed to be posted on. It would be better to include this infor... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,27 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The changes made in this hunk seem reasonable. The code now parses hunks and includes old and new code hunks with line numbers, which will make it easier for reviewers to understand the context of the changes. However, I noticed that the function `split_patch` is not defined in this file. Is it defined ... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,25 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The new changes look good. However, I suggest renaming the `patches` variable to something more descriptive like `hunks`. It will make the code more readable and easier to understand.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -76,7 +76,7 @@ export class Inputs {
this.filename = filename
this.file_content = file_content
this.file_diff = file_diff
- this.patches = patches
+ this.hunks = patches
this.diff = diff | :robot: OpenAI
The variable name `hunks` seems more appropriate than `patches`. Good change.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -123,8 +123,8 @@ export class Inputs {
if (this.file_diff) {
content = content.replace('$file_diff', this.file_diff)
}
- if (this.patches) {
- content = content.replace('$patches', this.patches)
+ if (this.hunks) {
+ content = content.replace('$patches', this.hunks)
} | :robot: OpenAI
I like the addition of the `hunks` variable, but I think it would be clearer to use the same terminology throughout the codebase. Instead of `$patches`, I suggest using `$hunks`.
129:
Typo: replace 'no diff' with '$diff'.
Overall, these changes seem well thought out and should improve the code review ... |
ai-pr-reviewer | github_2023 | others | 132 | coderabbitai | github-actions[bot] | @@ -161,59 +161,76 @@ inputs:
$summary
```
- Here is the content of file `$filename` -
+ Here is the content of file `$filename` with
+ line numbers -
```
$file_content
```
- Format for changes and review comments (if any)
- on line ranges (line numbers ... | :robot: OpenAI
I think this change could introduce a bug because...
```
Please note that the line numbers provided in the review comment must be within the line number ranges of new_hunks. Also, please ensure that your review comments are thorough and thoughtful, identifying any potential issues such as security, log... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -79,7 +79,7 @@ export const codeReview = async (
}
}
- // find patches to review
+ // find hunks to review
const filtered_files_to_review: (
| [string, string, string, [number, number, string][]]
| null | :robot: OpenAI
The variable `filtered_files_to_review` is of type `null | [string, string, string, [number, number, string][]]`. It would be better to use a more descriptive type alias or interface for this type instead of using a tuple. Also, it's not clear what the purpose of this variable is. Can you provide some c... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,27 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The `split_patch` function is used to split a patch into smaller patches, but it doesn't handle all cases correctly. Specifically, if a patch contains multiple hunks, it will only return the first hunk. This could result in missing review comments or incorrect line numbers. A better approach would be to... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -315,6 +328,14 @@ ${
ins.filename = filename
if (file_content.length > 0) {
+ const lines = file_content.split('\n')
+ let line_number = 1
+ file_content = ''
+ for (const line of lines) {
+ file_content += `${line_number}: ${line}
+`
+ line_number += 1
+... | :robot: OpenAI
The line numbers added to the file content are not accurate because they don't take into account the number of lines added by the previous hunks. This could result in incorrect line numbers in review comments. A better approach would be to keep track of the total number of lines added by previous hunks ... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -348,6 +369,17 @@ ${
} else {
comment_chain = ''
}
+ // check comment_chain tokens and skip if too long
+ const comment_chain_tokens = tokenizer.get_token_count(comment_chain)
+ if (
+ comment_chain_tokens >
+ options.heavy_token_lim... | :robot: OpenAI
In the `send_review_comment` function, you are checking the length of the `comment_chain` string and skipping sending if it exceeds a certain token limit. However, it's not clear what the purpose of the `comment_chain` string is or how it's being used. Can you provide some comments or documentation to e... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -414,14 +443,14 @@ ${comment_chain}
const reviewPromises = []
const skipped_files_to_review = []
- for (const [filename, file_content, , patches] of files_to_review) {
+ for (const [filename, file_content, , hunks] of files_to_review) {
if (
options.max_files_to_review <= 0 ||
... | :robot: OpenAI
I noticed that the variable `patches` has been renamed to `hunks` in this section of the code. It would be better to keep the variable names consistent throughout the codebase to avoid confusion.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,27 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The new format for displaying hunks and patches looks good. However, I noticed that the `patches` variable is now being used to store an array of `hunks`. This could be confusing for someone reading the code in the future. Consider renaming the variable to something more descriptive like `hunks_to_revie... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -484,21 +505,74 @@ const split_patch = (patch: string | null | undefined): string[] => {
const patch_start_end_line = (
patch: string
-): {start_line: number; end_line: number} | null => {
+): {
+ old_hunk: {start_line: number; end_line: number}
+ new_hunk: {start_line: number; end_line: number}
+} | null =>... | :robot: OpenAI
The changes made to this section of the code look good. However, I noticed that the `Review` type is no longer being used in the code. Consider removing this type definition to reduce clutter in the codebase.
Overall, the changes look good and seem to improve the readability of the code. However, pleas... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,27 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The new code adds a `parse_hunk` function that parses hunks and formats them as markdown. However, the function only returns the formatted hunks and not the line numbers of the hunk. It would be helpful to include the line numbers in the return value so that they can be used to create review comments.
... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -253,9 +255,11 @@ ${COMMENT_REPLY_TAG}
return comments.filter(
(comment: any) =>
comment.path === path &&
- comment.start_line === start_line &&
- comment.line === end_line &&
- comment.body !== ''
+ comment.body !== '' &&
+ ((comment.start_line &&
+ c... | :robot: OpenAI
In the `findReviewComments` function, the condition for filtering comments based on line numbers seems incorrect. The current condition checks if the start line number is greater than or equal to the given start line number and if the end line number is less than or equal to the given end line number. H... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -484,21 +505,74 @@ const split_patch = (patch: string | null | undefined): string[] => {
const patch_start_end_line = (
patch: string
-): {start_line: number; end_line: number} | null => {
+): {
+ old_hunk: {start_line: number; end_line: number}
+ new_hunk: {start_line: number; end_line: number}
+} | null =>... | :robot: OpenAI
The new implementation of `patch_start_end_line` and `parse_patch` functions seem to be working correctly. However, it would be helpful to add some unit tests to ensure that these functions are working as expected.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -120,14 +120,27 @@ export const codeReview = async (
const patches: [number, number, string][] = []
for (const patch of split_patch(file.patch)) {
const patch_lines = patch_start_end_line(patch)
- if (
- !patch_lines ||
- patch_lines.start_line === -1 ||
- pat... | :robot: OpenAI
The new implementation of `parse_patches` function seems to be generating a lot of unnecessary string concatenations and template literals. This could potentially impact performance, especially when dealing with large patches. Consider using a more efficient way to generate the `patches` array.
<!-- Th... |
ai-pr-reviewer | github_2023 | typescript | 132 | coderabbitai | github-actions[bot] | @@ -484,21 +505,74 @@ const split_patch = (patch: string | null | undefined): string[] => {
const patch_start_end_line = (
patch: string
-): {start_line: number; end_line: number} | null => {
+): {
+ old_hunk: {start_line: number; end_line: number}
+ new_hunk: {start_line: number; end_line: number}
+} | null =>... | :robot: OpenAI
In the `patch_start_end_line` and `parse_patch` functions, you are using a lot of magic numbers (e.g. 2, 3, 4, 5, etc.) to extract line numbers from the patch. This makes the code hard to read and understand. Consider using named constants or variables to make the code more readable.
Overall, the chang... |
ai-pr-reviewer | github_2023 | others | 131 | coderabbitai | github-actions[bot] | @@ -203,10 +203,7 @@ inputs:
code provided to you as the line number range is sufficient to map
your comment to the relevant code section in GitHub. Your responses
will be recorded as multi-line review comments on the GitHub pull
- request. Markdown format is preferred for your responses. C... | :robot: OpenAI
```diff
@@ -203,10 +203,8 @@ inputs:
code provided to you as the line number range is sufficient to map
your comment to the relevant code section in GitHub. Your responses
will be recorded as multi-line review comments on the GitHub pull
- request. Markdown format is preferr... |
ai-pr-reviewer | github_2023 | typescript | 129 | coderabbitai | github-actions[bot] | @@ -353,7 +353,13 @@ ${chain}
return top_level_comment
}
+ private reviewCommentsCache: Record<number, any[]> = {}
+
async list_review_comments(target: number) {
+ if (this.reviewCommentsCache[target]) {
+ return this.reviewCommentsCache[target]
+ }
+
const all_comments: any[] = []
le... | :robot: OpenAI
```diff
@@ -353,7 +353,13 @@ ${chain}
return top_level_comment
}
+ private reviewCommentsCache: Record<number, any[]> = {}
+
async list_review_comments(target: number) {
+ if (this.reviewCommentsCache[target]) {
+ return this.reviewCommentsCache[target]
+ }
+
const all_comm... |
ai-pr-reviewer | github_2023 | typescript | 129 | coderabbitai | github-actions[bot] | @@ -372,6 +378,7 @@ ${chain}
}
}
+ this.reviewCommentsCache[target] = all_comments
return all_comments
} catch (e) {
core.warning(`Failed to list review comments: ${e}`) | :robot: OpenAI
```diff
@@ -372,6 +378,7 @@ ${chain}
}
}
+ this.reviewCommentsCache[target] = all_comments
return all_comments
} catch (e) {
core.warning(`Failed to list review comments: ${e}`)
```
The addition of caching for review comments looks good. However, it would be be... |
ai-pr-reviewer | github_2023 | typescript | 129 | coderabbitai | github-actions[bot] | @@ -462,7 +469,13 @@ ${chain}
}
}
+ private issueCommentsCache: Record<number, any[]> = {}
+
async list_comments(target: number) {
+ if (this.issueCommentsCache[target]) {
+ return this.issueCommentsCache[target]
+ }
+
const all_comments: any[] = []
let page = 1
try { | :robot: OpenAI
```diff
@@ -462,7 +469,13 @@ ${chain}
}
}
+ private issueCommentsCache: Record<number, any[]> = {}
+
async list_comments(target: number) {
+ if (this.issueCommentsCache[target]) {
+ return this.issueCommentsCache[target]
+ }
+
const all_comments: any[] = []
let page = ... |
ai-pr-reviewer | github_2023 | typescript | 129 | coderabbitai | github-actions[bot] | @@ -481,6 +494,7 @@ ${chain}
}
}
+ this.issueCommentsCache[target] = all_comments
return all_comments
} catch (e: unknown) {
if (e instanceof ChatGPTError) { | :robot: OpenAI
```diff
@@ -481,6 +494,7 @@ ${chain}
}
}
+ this.issueCommentsCache[target] = all_comments
return all_comments
} catch (e: unknown) {
if (e instanceof ChatGPTError) {
```
The addition of caching for issue comments looks good. However, it would be better to add s... |
ai-pr-reviewer | github_2023 | others | 123 | coderabbitai | github-actions[bot] | @@ -89,11 +89,7 @@ inputs:
default: |
You are `@openai` (aka `github-actions[bot]`), a language model
trained by OpenAI. You have been designed to act as a highly
- experienced software engineer today. Your main task is to review
- code and documentation, provide suggestions, and write n... | :robot: OpenAI
```diff
@@ -89,11 +89,7 @@ inputs:
default: |
You are `@openai` (aka `github-actions[bot]`), a language model
trained by OpenAI. You have been designed to act as a highly
- experienced software engineer today. Your main task is to review
- code and documentation, provide ... |
ai-pr-reviewer | github_2023 | others | 123 | coderabbitai | github-actions[bot] | @@ -198,21 +194,11 @@ inputs:
<start_line-end_line>:
<review comment>
---
- <start_line-end_line>:
- <explain why suggestion makes sense>
- ```suggestion
- <replacement code that from start_line, with necessary changes>
- ```
- ---
...
You can comment o... | :robot: OpenAI
```text
The change made in this diff hunk removes the suggestion format for code changes. While this may be intentional, it may also make it harder for users to suggest code changes in a clear and concise manner. Consider providing an alternative format or explanation for how users can suggest code chan... |
ai-pr-reviewer | github_2023 | others | 123 | coderabbitai | github-actions[bot] | @@ -294,16 +280,7 @@ inputs:
If the comment contains instructions/requests for you, please comply.
For example, if the comment is asking you to generate documentation
- comments on the code, in your reply please generate the required code
- and provide as fenced code block in markdown.
-
- ... | :robot: OpenAI
```text
The change made in this diff hunk removes the fenced code block requirement for code change suggestions. While this may simplify the process, it may also make it harder to distinguish between regular comments and code change suggestions. Consider keeping the fenced code block requirement or prov... |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -91,7 +91,9 @@ inputs:
trained by OpenAI. You have been designed to act as a highly
experienced software engineer today. Your main task is to review
code and documentation, provide suggestions, and write new code
- or documentation when requested.
+ or documentation when requested. ... | :robot: OpenAI
The new instructions are clear and helpful. However, I suggest rephrasing the sentence "Please ensure that your responses are focused on assisting with code and documentation concerns, following best practices and industry standards" to "Please ensure that your responses focus on assisting with code and... |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -183,7 +186,7 @@ inputs:
displaying added, removed, and unchanged lines with
"+" or "-" prefixes and surrounding context lines.
- Patches for review are below -
+ Diff hunks for review are below -
$patches
| :robot: OpenAI
It would be better to use the term "diff hunks" instead of "patches" throughout the document to avoid confusion.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -229,7 +236,7 @@ inputs:
required: false
description: 'Prompt for comment'
default: |
- A comment was made on a review for a diff patch on file
+ A comment was made on a review for a diff hunk on file
`$filename`. I would like you to follow the instructions
in that comment. ... | :robot: OpenAI
Please change the section header from "Prompt for Comment" to "Prompt for Comment on Diff Hunk".
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -297,10 +304,11 @@ inputs:
and provide as fenced code block in markdown.
Any code change suggestion to the diff hunk must be enclosed in fenced code
- blocks with the suggestion identifier -
+ blocks with the suggestion identifier and the change must completely
+ replace the diff hun... | :robot: OpenAI
Please change the section header from "Code Change Suggestions" to "Code Change Suggestions for Diff Hunks". Additionally, please clarify that any code change suggestion to the diff hunk must be enclosed in fenced code blocks with the suggestion identifier and the change must completely replace the diff... |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -165,15 +167,15 @@ inputs:
$file_content
```
- Below is the format for patches. `---`
- separator is used between patches.
+ Format for changes and review comments on line ranges.
+ `---` separator is used.
<start_line-end_line>:
```diff
<diff_hunk>
... | :robot: OpenAI
The format for changes and review comments on line ranges is not clear. It would be helpful to provide an example of how to use this format.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 122 | coderabbitai | github-actions[bot] | @@ -198,29 +200,28 @@ inputs:
---
<start_line-end_line>:
<explain why suggestion makes sense>
- ```diff
- <suggested diff>
+ ```suggestion
+ <replacement code that from start_line, with necessary changes>
```
---
- <start_line-end_line>:
- <explain why ne... | :robot: OpenAI
When suggesting a code change, it is important that you provide the new code that replaces the entire line range in the diff hunk from the beginning, including the context lines in the diff hunk. Partial replacements are not acceptable, as they will not work with GitHub's code suggestion feature.
Pleas... |
ai-pr-reviewer | github_2023 | others | 121 | coderabbitai | github-actions[bot] | @@ -213,11 +213,7 @@ inputs:
You can comment or suggest code changes for the patches and the
line ranges provided by you should map to the exact line ranges
- provided in the patches. When suggesting a code change, it is
- important that you provide the new code that replaces the entire
- ... | :robot: OpenAI
I suggest removing the sentence "Partial replacements are not acceptable, as they will not work with GitHub's code suggestion feature." This is no longer applicable since the restriction on partial replacements has been removed.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 121 | coderabbitai | github-actions[bot] | @@ -91,9 +91,7 @@ inputs:
trained by OpenAI. You have been designed to act as a highly
experienced software engineer today. Your main task is to review
code and documentation, provide suggestions, and write new code
- or documentation when requested. Please ensure that your responses
- ... | :robot: OpenAI
I suggest keeping the requirement for responses to follow best practices and industry standards. This ensures that the code review process maintains a high level of quality and consistency.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 121 | coderabbitai | github-actions[bot] | @@ -200,8 +198,8 @@ inputs:
---
<start_line-end_line>:
<explain why suggestion makes sense>
- ```suggestion
- <replacement code that from start_line, with necessary changes>
+ ```diff
+ <suggested diff>
```
---
<start_line-end_line>: | :robot: OpenAI
I suggest changing the suggested diff format from `diff` to `suggestion`. This will make it consistent with the current format used in the file.
```diff
@@ -200,8 +198,8 @@ inputs:
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 121 | coderabbitai | github-actions[bot] | @@ -303,11 +297,10 @@ inputs:
and provide as fenced code block in markdown.
Any code change suggestion to the diff hunk must be enclosed in fenced code
- blocks with the suggestion identifier and the change must completely
- replace the diff hunk provided to you from the beginning -
+ b... | :robot: OpenAI
I suggest adding an explanation for why suggested diffs should completely replace the diff hunk provided from the beginning. This will help ensure that the suggested changes are clear and complete.
```diff
@@ -303,11 +297,12 @@ inputs:
and provide as fenced code block in markdown.
Any ... |
ai-pr-reviewer | github_2023 | others | 120 | coderabbitai | github-actions[bot] | @@ -213,9 +213,11 @@ inputs:
You can comment or suggest code changes for the patches and the
line ranges provided by you should map to the exact line ranges
- provided in the patches. When suggesting a code change, please
- provide the new code that replaces the entire patch from the
- ... | :robot: OpenAI
```diff
@@ -213,9 +213,11 @@ inputs:
You can comment or suggest code changes for the patches and the
line ranges provided by you should map to the exact line ranges
- provided in the patches. When suggesting a code change, please
- provide the new code that replaces the enti... |
ai-pr-reviewer | github_2023 | others | 120 | coderabbitai | github-actions[bot] | @@ -201,7 +201,7 @@ inputs:
<start_line-end_line>:
<explain why suggestion makes sense>
```suggestion
- <replacement code>
+ <replacement code that completely replaces the line range>
```
---
<start_line-end_line>: | :robot: OpenAI
It would be helpful to include an explanation of why the suggested change makes sense. Additionally, please ensure that the replacement code completely replaces the line range specified in the patch from the beginning. Partial replacements are not acceptable.
```suggestion
<replacement code that compl... |
ai-pr-reviewer | github_2023 | others | 120 | coderabbitai | github-actions[bot] | @@ -201,7 +201,7 @@ inputs:
<start_line-end_line>:
<explain why suggestion makes sense>
```suggestion
- <replacement code>
+ <replacement code that from start_line, with necessary changes>
```
---
<start_line-end_line>: | :robot: OpenAI
```diff
@@ -201,7 +201,7 @@ inputs:
<start_line-end_line>:
<explain why suggestion makes sense>
```suggestion
- <replacement code>
+ <replacement code that from start_line, with necessary changes>
```
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 117 | coderabbitai | github-actions[bot] | @@ -134,7 +134,8 @@ ${tag}`
pull_number: number,
commit_id: string,
path: string,
- line: number,
+ start_line: number,
+ end_line: number,
message: string,
tag: string = COMMENT_TAG
) { | :robot: OpenAI
The `Commenter` class has been modified to handle ranges instead of single lines. The `createReviewComment` method call now includes the new `start_line` and `end_line` parameters. However, it seems that the `end_line` parameter is not being used in the method implementation. Please update the implement... |
ai-pr-reviewer | github_2023 | typescript | 117 | coderabbitai | github-actions[bot] | @@ -146,10 +147,17 @@ ${tag}`
// replace comment made by this action
try {
let found = false
- const comments = await this.get_comments_at_line(pull_number, path, line)
+ const comments = await this.get_comments_at_range(
+ pull_number,
+ path,
+ start_line,
+ end_... | :robot: OpenAI
In the `update_review_comment` method, the logging message still refers to `line` instead of `end_line`. Please update the logging message to reflect the change from `line` to `end_line`.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 117 | coderabbitai | github-actions[bot] | @@ -162,15 +170,19 @@ ${tag}`
}
if (!found) {
- core.info(`Creating new review comment for ${path}:${line}: ${message}`)
+ core.info(
+ `Creating new review comment for ${path}:${end_line}: ${message}`
+ )
await octokit.pulls.createReviewComment({
owner:... | :robot: OpenAI
In the `create_new_review_comment` method, the logging message still refers to `line` instead of `end_line`. Please update the logging message to reflect the change from `line` to `end_line`.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 117 | coderabbitai | github-actions[bot] | @@ -231,24 +243,34 @@ ${COMMENT_REPLY_TAG}
}
}
- async get_comments_at_line(pull_number: number, path: string, line: number) {
+ async get_comments_at_range(
+ pull_number: number,
+ path: string,
+ start_line: number,
+ end_line: number
+ ) {
const comments = await this.list_review_commen... | :robot: OpenAI
In the `get_comments_at_range` method, the `line` parameter is being compared with `end_line` instead of `start_line`. Please update the comparison to use `start_line` instead of `line`.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 118 | coderabbitai | github-actions[bot] | @@ -207,12 +207,7 @@ inputs:
review comment.
Your responses will be recorded as review comments on the
- pull request. Markdown format is preferred for your responses. Any
- code suggestions that you suggest must be enclosed in fenced code
- blocks with the suggestion identifier -
- ... | :robot: OpenAI
The updated description of the `comment` input mentions that Markdown format is preferred for responses. However, the previous description also mentioned fenced code blocks with suggestion identifiers for code suggestions. It might be helpful to keep this information in the description as well, since it... |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -7,6 +7,7 @@ import {codeReview} from './review.js'
async function run(): Promise<void> {
const options: Options = new Options(
core.getBooleanInput('debug'),
+ core.getBooleanInput('summary_only'),
core.getInput('max_files_to_summarize'),
core.getInput('max_files_to_review'),
core.getBool... | :robot: OpenAI
The addition of the `summary_only` flag seems fine. However, it is not clear how this flag will be used in the code. It would be helpful to add a comment or documentation explaining how this flag affects the behavior of the code.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -37,10 +38,7 @@ async function run(): Promise<void> {
try {
lightBot = new Bot(
options,
- new OpenAIOptions(
- options.openai_light_model,
- options.summary_token_limits
- )
+ new OpenAIOptions(options.openai_light_model, options.light_token_limits)
)
} catch (e: ... | :robot: OpenAI
It looks like the `summary_token_limits` property has been replaced with `light_token_limits`. Is this intentional? If so, please update the documentation and comments to reflect this change.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -53,7 +51,7 @@ async function run(): Promise<void> {
try {
heavyBot = new Bot(
options,
- new OpenAIOptions(options.openai_heavy_model, options.review_token_limits)
+ new OpenAIOptions(options.openai_heavy_model, options.heavy_token_limits)
)
} catch (e: any) {
core.warning( | :robot: OpenAI
Similar to the previous patch, it looks like the `review_token_limits` property has been replaced with `heavy_token_limits`. Please update the documentation and comments to reflect this change.
<!-- This is an auto-generated comment by OpenAI --> |
ai-pr-reviewer | github_2023 | others | 114 | coderabbitai | github-actions[bot] | @@ -98,8 +98,28 @@ Thumbs.db
__tests__/runner/*
lib/**/*
+### Tags
+# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
+TAGS
+.TAGS
+!TAGS/
+tags
+.tags
+!tags/
+gtags.files
+GTAGS
+GRTAGS
+GPATH
+GSYMS
+cscope.files
+cscope.out
+cscope.in.out
+cscope.po.out
+tags.temp
+tags.lock
+
+
# Local test... | :robot: OpenAI
The addition of the section to ignore tags created by various tag generators and temporary files related to these tag generators in `.gitignore` is a good practice. However, it would be better if you could add a comment explaining why these tags are being ignored.
Also, it seems that there are some re... |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -137,7 +137,7 @@ export const handleReviewComment = async (
if (file_content.length > 0) {
const file_content_tokens = tokenizer.get_token_count(file_content)
if (
- file_content_tokens < options.review_token_limits.extra_content_tokens
+ file_content_tokens < options.heavy... | :robot: OpenAI
The `handleReviewComment` function is using the `options.review_token_limits.extra_content_tokens` property to check if the number of tokens in the file content is within limits. However, this property has been renamed to `options.heavy_token_limits.extra_content_tokens` in the pull request. This incons... |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -150,7 +150,7 @@ export const handleReviewComment = async (
}
const file_diff_tokens = tokenizer.get_token_count(file_diff)
if (
- file_diff_tokens < options.review_token_limits.extra_content_tokens
+ file_diff_tokens < options.heavy_token_limits.extra_content_tokens
... | :robot: OpenAI
Similar to the previous patch, the `handleReviewComment` function is using the `options.review_token_limits.extra_content_tokens` property to check if the number of tokens in the file diff is within limits. However, this property has been renamed to `options.heavy_token_limits.extra_content_tokens` in t... |
ai-pr-reviewer | github_2023 | typescript | 114 | coderabbitai | github-actions[bot] | @@ -147,7 +147,7 @@ export const codeReview = async (
if (file_content.length > 0) {
if (
tokenizer.get_token_count(file_content) <
- options.summary_token_limits.extra_content_tokens
+ options.light_token_limits.extra_content_tokens
) {
ins.file_content ... | :robot: OpenAI
The `options.summary_token_limits` property has been renamed to `options.light_token_limits`. However, the corresponding check in this patch still uses the old property name. This should be updated to use the new property name.
```diff
@@ -147,7 +147,7 @@ export const codeReview = async (
if (fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.