-
Notifications
You must be signed in to change notification settings - Fork 2
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
added complete once if possible, added jira integration #4
Conversation
} | ||
|
||
return nil | ||
return overallCompletion, nil | ||
} |
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 adds a new flag JiraURL
to the CLI and a new import package jira
. The genCompletionOnce
and genCompletionPerFile
functions are refactored to accept an OpenAI client as an argument. The run
function now checks for the Test
flag and prints the completion output if it is set to true. A new genCompletionPerFile
function is introduced to generate completion for files with diffs greater than 4000 bytes. The main
function reads the JiraURL
flag, checks for the Test
flag, and calls the run
function to update the pull request description.
The code looks easy to read, and the changes made seem reasonable. However, it is hard to tell if there are any bugs or risks without understanding the full context of the code and its usage. As for improvement suggestions, it would be helpful to add comments to explain the purpose and functionality of the added code. Additionally, error handling could be improved by providing more detailed error messages when returning errors.
|
||
func GenerateJiraTicketURL(jiraURL, ticketID string) string { | ||
return fmt.Sprintf(ticketUrlFormat, jiraURL, ticketID) | ||
} |
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.
This code patch adds functionality for extracting JIRA ticket IDs from a string and generating a JIRA URL for a given ticket ID. Overall, the code seems simple and straightforward.
One potential improvement could be to add more robust error handling for the GenerateJiraTicketURL
function, such as checking that the JIRA URL string is not empty. Additionally, it may be helpful to add some documentation or comments to explain the purpose of the ticketUrlFormat
constant.
Overall, the code seems low-risk for introducing bugs.
} | ||
}) | ||
} | ||
} |
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.
This code patch adds a test function for a ExtractJiraTicketID
function implemented elsewhere. The test function contains multiple test cases to test the functionality of the ExtractJiraTicketID
function in multiple scenarios. The test cases vary based on the input strings and the expected output.
Overall, the code patch looks good, and the testing strategy is quite comprehensive. However, one suggestion for improvement could be to include some edge cases, such as very long input strings or non-alphanumeric characters in the input string. Additionally, it might be a good idea to check for the error message in the test cases that expect an error to ensure that the correct type of error is being thrown.
# Conflicts: # cmd/description/main.go
Description
This pull request adds the ability to integrate Jira tickets into pull request descriptions, and updates the completion logic based on the size of the diff. It also includes a new function and method in the
jira
package to extract and generate Jira ticket URLs.Changes
cmd/description/main.go
to support adding Jira ticket URLs and update completion logic.ExtractJiraTicketID()
, tojira/jira.go
to extract the first Jira ticket ID from input strings.GenerateJiraTicketURL()
, tojira/jira.go
to generate the complete URL for a given Jira ticket ID.jira/jira_test.go
to cover multiple scenarios and added a new test case for lowercase ticket ID validation.Files Changed