Address code issues in JetBrains and Visual Studio Code
To address a code issue in JetBrains and Visual Studio Code, you will either have the option to generate an in-place
fix or generate an explanation that you can use to manually update your code.
You can take the following actions:
-
Generate an in-place code fix
-
Explain the issue and get new code
-
Ignore the issue, or ignore all similar issues
Generate in place fixes for your file
Amazon Q can update your files in-place to automatically remediate a code issue it detected.
To automatically fix a code issue in your file:
- JetBrains
-
-
In the Problems tool window, in the
Amazon Q Code Issues tab, choose the
code issue you want to address.
-
A panel opens with more information about the code issue.
If applicable, you'll see details about the Amazon Q
detector that was used to identify the code issue.
-
Along the bottom of the panel, choose Fix.
-
In the chat panel, Amazon Q provides a brief explanation
of the fix and then applies an in-place fix in your code
file.
-
You will see the code change in your file, and have the
option to undo the change from the chat panel.
- Visual Studio Code
-
-
In the Code Issues tab, choose the code issue you want to address.
-
Choose the wrench icon.
The following image shows the wrench icon for a code issue in Visual Studio Code.
-
In the chat panel, Amazon Q provides a brief explanation
of the fix and then applies an in-place fix in your code
file.
-
You will see the code change in your file, and have the
option to undo the change from the chat panel.
Explain the code issue and get new code
Amazon Q can provide an in-depth explanation of a code issue and provide
remediation options with accompanying code for you to add to your files.
To get an explanation of a code issue:
- JetBrains IDEs
-
-
In the Problems tool window, in the
Amazon Q Code Issues tab, choose the
code issue you want to address.
-
A panel opens with more information about the code issue.
If applicable, you'll see details about the Amazon Q
detector that was used to identify the code issue.
-
Along the bottom of the panel, choose Explain.
-
In the chat panel, Amazon Q provides details about the issue and
suggests how to fix it, with code that you can insert into your
file.
-
To update your file, follow Amazon Q’s instructions for where to add
or replace code, and copy the provided code in the correct location in
your file. Make sure to remove the vulnerable code when adding the updated code.
- Visual Studio Code
-
-
In the Code Issues tab, choose the code issue you want to address.
-
Choose the magnifying glass icon.
The following image shows the magnifying glass icon for a code issue in Visual Studio Code.
-
In the chat panel, Amazon Q provides details about the issue and
suggests how to fix it, with code that you can insert into your
file.
-
To update your file, follow Amazon Q’s instructions for where to add
or replace code, and copy the provided code in the correct location in
your file. Make sure to remove the vulnerable code when adding the updated code.
Ignore a code issue
If a detected code issue isn’t applicable, you can choose to ignore it, or
ignore it and all similar issues (issues with the same CWE). The issues will be removed from the Code
Issues tab.
To ignore a code issue:
- JetBrains
-
-
In the Problems tool window, in the
Amazon Q Code Issues tab, choose the
code issue you want to ignore.
-
A panel opens with more information about the code issue.
Along the bottom of the panel, choose
Ignore. The code issue is removed
from the Code Issue panel.
-
You can also choose Ignore All to
ignore this and other code issues with the same CWE.
- Visual Studio Code
-
-
In the Code Issues tab, choose the code issue you want to ignore.
-
Choose the ignore icon.
The following image shows the ignore icon for a code issue in Visual Studio Code.
-
The code issue is removed from the Code Issue panel.
-
To ignore similar issues, choose the elipses icon, and then the choose
Ignore Similar Issues button that appears.