Skip to content

Commit 231e669

Browse files
committed
Revert "Merge pull request aws#7696 from singhAws/code-review-tool"
This reverts commit 3898ca2, reversing changes made to c43ff0f.
1 parent f2755a9 commit 231e669

File tree

5 files changed

+11
-46
lines changed

5 files changed

+11
-46
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ import { decryptResponse, encryptRequest } from '../encryption'
9595
import { getCursorState } from '../utils'
9696
import { focusAmazonQPanel } from './commands'
9797
import { ChatMessage } from '@aws/language-server-runtimes/server-interface'
98-
import { CommentUtils } from 'aws-core-vscode/utils'
9998

10099
export function registerActiveEditorChangeListener(languageClient: LanguageClient) {
101100
let debounceTimer: NodeJS.Timeout | undefined
@@ -702,7 +701,7 @@ async function handleCompleteResult<T extends ChatResult>(
702701
) {
703702
const decryptedMessage = await decryptResponse<T>(result, encryptionKey)
704703

705-
await handleSecurityFindings(decryptedMessage, languageClient)
704+
handleSecurityFindings(decryptedMessage, languageClient)
706705

707706
void provider.webview?.postMessage({
708707
command: chatRequestType.method,
@@ -717,10 +716,10 @@ async function handleCompleteResult<T extends ChatResult>(
717716
disposable.dispose()
718717
}
719718

720-
async function handleSecurityFindings(
719+
function handleSecurityFindings(
721720
decryptedMessage: { additionalMessages?: ChatMessage[] },
722721
languageClient: LanguageClient
723-
): Promise<void> {
722+
): void {
724723
if (decryptedMessage.additionalMessages === undefined || decryptedMessage.additionalMessages.length === 0) {
725724
return
726725
}
@@ -731,18 +730,10 @@ async function handleSecurityFindings(
731730
try {
732731
const aggregatedCodeScanIssues: AggregatedCodeScanIssue[] = JSON.parse(message.body)
733732
for (const aggregatedCodeScanIssue of aggregatedCodeScanIssues) {
734-
const document = await vscode.workspace.openTextDocument(aggregatedCodeScanIssue.filePath)
735733
for (const issue of aggregatedCodeScanIssue.issues) {
736-
const isIssueTitleIgnored = CodeWhispererSettings.instance
734+
issue.visible = !CodeWhispererSettings.instance
737735
.getIgnoredSecurityIssues()
738736
.includes(issue.title)
739-
const isSingleIssueIgnored = CommentUtils.detectCommentAboveLine(
740-
document,
741-
issue.startLine,
742-
CodeWhispererConstants.amazonqIgnoreNextLine
743-
)
744-
745-
issue.visible = !isIssueTitleIgnored && !isSingleIssueIgnored
746737
}
747738
}
748739
initSecurityScanRender(aggregatedCodeScanIssues, undefined, CodeAnalysisScope.PROJECT)

packages/amazonq/src/lsp/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ export async function startLanguageServer(
186186
reroute: true,
187187
modelSelection: true,
188188
workspaceFilePath: vscode.workspace.workspaceFile?.fsPath,
189-
qCodeReviewInChat: true,
190189
},
191190
window: {
192191
notifications: true,

packages/amazonq/test/unit/codewhisperer/service/securityIssueHoverProvider.test.ts

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,17 @@ describe('securityIssueHoverProvider', () => {
2121
token = new vscode.CancellationTokenSource()
2222
})
2323

24-
function buildCommandLink(
25-
command: string,
26-
commandIcon: string,
27-
args: any[],
28-
label: string,
29-
tooltip: string
30-
): string {
31-
return `[$(${commandIcon}) ${label}](command:${command}?${encodeURIComponent(JSON.stringify(args))} '${tooltip}')`
24+
function buildCommandLink(command: string, args: any[], label: string, tooltip: string): string {
25+
return `[$(${command.includes('ignore') ? 'error' : 'comment'}) ${label}](command:${command}?${encodeURIComponent(JSON.stringify(args))} '${tooltip}')`
3226
}
3327

3428
function buildExpectedContent(issue: any, fileName: string, description: string, severity?: string): string {
3529
const severityBadge = severity ? ` ![${severity}](severity-${severity.toLowerCase()}.svg)` : ' '
3630
const commands = [
37-
buildCommandLink(
38-
'aws.amazonq.explainIssue',
39-
'comment',
40-
[issue, fileName],
41-
'Explain',
42-
'Explain with Amazon Q'
43-
),
44-
buildCommandLink('aws.amazonq.generateFix', 'wrench', [issue, fileName], 'Fix', 'Fix with Amazon Q'),
45-
buildCommandLink(
46-
'aws.amazonq.security.ignore',
47-
'error',
48-
[issue, fileName, 'hover'],
49-
'Ignore',
50-
'Ignore Issue'
51-
),
52-
buildCommandLink(
53-
'aws.amazonq.security.ignoreAll',
54-
'error',
55-
[issue, 'hover'],
56-
'Ignore All',
57-
'Ignore Similar Issues'
58-
),
31+
buildCommandLink('aws.amazonq.explainIssue', [issue, fileName], 'Explain', 'Explain with Amazon Q'),
32+
buildCommandLink('aws.amazonq.generateFix', [issue, fileName], 'Fix', 'Fix with Amazon Q'),
33+
buildCommandLink('aws.amazonq.security.ignore', [issue, fileName, 'hover'], 'Ignore', 'Ignore Issue'),
34+
buildCommandLink('aws.amazonq.security.ignoreAll', [issue, 'hover'], 'Ignore All', 'Ignore Similar Issues'),
5935
]
6036
return `## title${severityBadge}\n${description}\n\n${commands.join('\n | ')}\n`
6137
}

packages/core/src/codewhisperer/service/securityIssueHoverProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class SecurityIssueHoverProvider implements vscode.HoverProvider {
9090
const generateFixCommand = this._getCommandMarkdown(
9191
'aws.amazonq.generateFix',
9292
[issue, filePath],
93-
'wrench',
93+
'comment',
9494
'Fix',
9595
'Fix with Amazon Q'
9696
)

packages/core/src/shared/utilities/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ export { isExtensionInstalled, isExtensionActive } from './vsCodeUtils'
77
export { VSCODE_EXTENSION_ID } from '../extensions'
88
export * from './functionUtils'
99
export * as messageUtils from './messages'
10-
export * as CommentUtils from './commentUtils'

0 commit comments

Comments
 (0)