Reviewing code with Amazon Q Developer in GitHub
Note
Amazon Q Developer for GitHub is in preview release and is subject to change.
Amazon Q Developer enables automated code reviews within GitHub. When you create a new pull request or reopen a closed pull request, Amazon Q Developer automatically performs a code review and provides feedback on code quality, potential issues, and high-severity findings. Amazon Q Developer also generates fixes for the identified issues, which you can review and choose to commit to the pull request. Automatic code reviews are not triggered by subsequent commits made within an existing pull request.
You can also initiate code reviews within pull requests with the /q review
slash command. The quick
action can be added to a new pull request comment, which initiates a new code review of the pull request in its current
state, including any comments and new commits. For more information, see Initiating code reviews with Amazon Q Developer in GitHub pull
requests.
You can have Amazon Q Developer perform a code review for a limited amount of lines per month. You can increase your free usage at any time by registering your Amazon Q Developer app installation with your AWS account. For more information, see Increasing usage limits and configuring details in Amazon Q Developer console.
Note
If the code review capability was previously disabled, it must be enabled in the
Amazon Q Developer
console
To use Amazon Q Developer for code reviews and apply fixes
-
If necessary, sign in to your GitHub
account using your GitHub credentials. -
Navigate to your GitHub organization, and then navigate to the repository you want to perform a code review with Amazon Q Developer.
-
Create a new a pull request for changes made to your source code. For more information, see Creating a pull request
in the GitHub documentation. When you create a new pull request, Amazon Q Developer automatically begins a code review to find potential issues. Once Amazon Q Developer completes the review, it submits each finding as a separate comment, as well as suggested fixes that you can commit to the pull request.
-
Review the proposed code changes by Amazon Q Developer, choose Commit suggestion, and then choose Commit changes to update the pull request.
-
If you're satisfied with the suggested code fixes, you can merge the pull request to apply the code changes suggested by Amazon Q Developer. For more information, see Merging a pull request
in the GitHub documentation.
Initiating code reviews with Amazon Q Developer in GitHub pull requests
After an automatic code review performed by Amazon Q Developer for a new or reopened GitHub pull request,
you can initiate additional code reviews to iterate on your code using the /q review
slash command. The code review is performed on the entire pull request's diff.
Note
You can only initiate a code review within a pull request with a new comment. The
/q review
slash command will not work in an existing comment thread.
To use initiate code reviews in a pull request
-
If necessary, sign in to your GitHub
account using your GitHub credentials. -
Navigate to your GitHub organization, and then navigate to the pull request you want to perform a code review with Amazon Q Developer. For more information, see About pull requests
. -
Within the pull request, navigate to Add a comment, and in the comment text input field, enter
/q review
. -
Choose Comment to initiate the code review.
It can take a few minutes for Amazon Q Developer to complete analyzing the pull request code. After Amazon Q Developer finishes analyzing, it replies to your comment with its critical and severity findings, as well as proposed changes you can choose to commit and update the pull request.
-
If you're satisfied with the suggested code fixes, you can merge the pull request to apply the code changes suggested by Amazon Q Developer. For more information, see Merging a pull request
in the GitHub documentation.