-
Notifications
You must be signed in to change notification settings - Fork 2
file is null causing fail, if null skipping file #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,10 @@ func run(ctx context.Context) error { | |
continue | ||
} | ||
|
||
if file.Patch == nil { | ||
continue | ||
} | ||
|
||
prompt := fmt.Sprintf(oAIClient.PromptReview, *file.Patch) | ||
|
||
if len(prompt) > 4096 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code patch seems to be checking if the file has a patch before prompting for review. This could be helpful in avoiding unnecessary prompts and saving resources. However, without seeing the surrounding code, it's unclear if this is the best way to handle this scenario. One potential improvement suggestion could be to provide more detailed error messages or debug logging to help diagnose any issues that arise during the run function. Additionally, adding some comments to the code can help make it more understandable to others who may review or work on it in the future. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ import ( | |
const ( | ||
PromptDescribeChanges = "Bellow is the code patch, Generate a GitHub pull request description based on the following comments without basic prefix\n%s\n" | ||
PromptOverallDescribe = "Bellow comments are generated by AI, Generate a GitHub pull request description based on the following comments without basic prefix in markdown format with ### Description and ### Changes blocks:\n%s\n" | ||
PromptReview = "Bellow is the code patch, please help me do a brief code review,Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n" | ||
PromptOverallReview = "Bellow comments are generated by AI, please help me do a brief code review,Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n" | ||
PromptReview = "Bellow is the code patch, please help me do a brief code review, Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n" | ||
PromptOverallReview = "Bellow comments are generated by AI, please help me do a brief code review, Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n" | ||
) | ||
|
||
type Client struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code patch includes changes to the prompts in the As it is a small change, there is not much bug risk involved. However, it is always important to test the changes after they are made to ensure that they do not cause any issues. As for improvement suggestions, it may be helpful to have clearer prompts for the user to know what is expected of them when reviewing code or generating pull request descriptions. This could potentially save time and confusion in the long run. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code patch looks fine overall. The addition of a check for file.Patch being nil and continuing the loop if true is good to prevent any potential errors. Possible improvements could be to utilize error handling for any potential errors that could occur during the code execution. Additionally, using constants for hard-coded values such as the prompt length limit could improve code readability and maintainability. Overall, there doesn't seem to be any major bug risk.