

# Addressing code issues with Amazon Q Developer
<a name="address-code-issues"></a>

The topics in this section explain how to address and resolve code issues, and, where applicable, how to ignore issues.

**Topics**
+ [Address code issues in JetBrains and Visual Studio Code](address-issues-jetbrains-visualstudiocode.md)
+ [Address code issues in Visual Studio](address-issues-visualstudio.md)

# Address code issues in JetBrains and Visual Studio Code
<a name="address-issues-jetbrains-visualstudiocode"></a>

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
<a name="generate-fixes"></a>

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 ]

1. In the **Problems** tool window, in the **Amazon Q Code Issues** tab, choose the code issue you want to address.

1. 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.

1. Along the bottom of the panel, choose **Fix**. 

1. In the chat panel, Amazon Q provides a brief explanation of the fix and then applies an in-place fix in your code file.

1. You will see the code change in your file, and have the option to undo the change from the chat panel.

------
#### [ Visual Studio Code ]

1. In the **Code Issues** tab, choose the code issue you want to address.

1. Choose the wrench icon.

   The following image shows the wrench icon for a code issue in Visual Studio Code.  
![\[The wrench icon for a code issue in Visual Studio Code, used to generate a code fix.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/code-review-fix-vsc.png)

1. In the chat panel, Amazon Q provides a brief explanation of the fix and then applies an in-place fix in your code file.

1. 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
<a name="explain-issue"></a>

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 ]

1. In the **Problems** tool window, in the **Amazon Q Code Issues** tab, choose the code issue you want to address.

1. 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.

1. Along the bottom of the panel, choose **Explain**. 

1. 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.

1. 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 ]

1. In the **Code Issues** tab, choose the code issue you want to address.

1. Choose the magnifying glass icon.

   The following image shows the magnifying glass icon for a code issue in Visual Studio Code.  
![\[The magnifying glass icon for a code issue in Visual Studio Code, used to explain a code issue.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/code-review-view-details-vsc.png)

1. 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.

1. 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
<a name="ignore-issues"></a>

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 ]

1. In the **Problems** tool window, in the **Amazon Q Code Issues** tab, choose the code issue you want to ignore.

1. 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.

1. You can also choose **Ignore All** to ignore this and other code issues with the same CWE.

------
#### [ Visual Studio Code ]

1. In the **Code Issues** tab, choose the code issue you want to ignore.

1. Choose the ignore icon.

   The following image shows the ignore icon for a code issue in Visual Studio Code.  
![\[The ignore icon for a code issue in Visual Studio Code, used to ignore and close a code issue.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/code-review-ignore-issue-vsc.png)

1. The code issue is removed from the Code Issue panel.

1. To ignore similar issues, choose the elipses icon, and then the choose **Ignore Similar Issues** button that appears.

------

# Address code issues in Visual Studio
<a name="address-issues-visualstudio"></a>

To view code issues detected by Amazon Q in Visual Studio, open the Visual Studio **Error List** by expanding the **View** heading in the Visual Studio main menu and choosing **Error List**.

You can use the information in the code issue to update your code. After updating your code, review your code again to see if the issues were addressed.

By default, the Visual Studio **Error List** displays all of the warnings and errors for your code base. To filter your Amazon Q code issues from the Visual Studio **Error List**, create a filter by completing the following procedure.

**Note**  
Code issues are only visible after you've run a code review in which Amazon Q detected issues.  
Code issues appear as warnings in Visual Studio. In order to view issues detected by Amazon Q in the **Error List**, the **Warnings** option in the **Error List** heading must be selected.

**Filter code issues in the Error List**

1. From the Visual Studio main menu, choose view and then **Error List** to open the **Error List** pane.

1. From the **Error List** pane, right-click the header row to open the context menu.

1. From the context menu, expand **Show Columns**, and then select **Tool** in the expanded menu.

1. The **Tool** column is added to your **Error List**.

1. From the **Tool** column header, select the **Filter** icon and choose **Amazon Q** to filter for Amazon Q code issues.