Skip to content

Commit 6989ed6

Browse files
authored
feat(amazonq): add new languages for auto scan (#5934)
## Problem Auto scan and security issue components are not enabled for some languages available in code scan service. ## Solution Add support for new languages for code scan. --- License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2c356e3 commit 6989ed6

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Security Scan: Auto-scan now supports JSX, TSX, Kotlin, Scala, and Shell files."
4+
}

packages/amazonq/test/unit/codewhisperer/util/securityScanLanguageContext.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ describe('securityScanLanguageContext', function () {
1717
['javascript', true],
1818
['typescript', true],
1919
['jsx', false],
20-
['javascriptreact', false],
21-
['typescriptreact', false],
20+
['javascriptreact', true],
21+
['typescriptreact', true],
2222
['tsx', false],
2323
['csharp', true],
2424
['python', true],
2525
['c', true],
2626
['cpp', true],
2727
['go', true],
28-
['kotlin', false],
28+
['kotlin', true],
2929
['php', true],
3030
['ruby', true],
3131
['rust', false],
32-
['scala', false],
33-
['shellscript', false],
32+
['scala', true],
33+
['shellscript', true],
3434
['sql', false],
3535
['json', true],
3636
['yaml', true],
@@ -92,7 +92,9 @@ describe('securityScanLanguageContext', function () {
9292
['java', 'java'],
9393
['python', 'python'],
9494
['javascript', 'javascript'],
95+
['javascriptreact', 'javascript'],
9596
['typescript', 'typescript'],
97+
['typescriptreact', 'typescript'],
9698
['csharp', 'csharp'],
9799
['go', 'go'],
98100
['ruby', 'ruby'],
@@ -112,6 +114,9 @@ describe('securityScanLanguageContext', function () {
112114
['java-properties', 'plaintext'],
113115
['go.mod', 'plaintext'],
114116
['go.sum', 'plaintext'],
117+
['kotlin', 'kotlin'],
118+
['scala', 'scala'],
119+
['shellscript', 'shell'],
115120
]
116121

117122
for (const [securityScanLanguageId, expectedCwsprLanguageId] of securityScanLanguageIds) {

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ export const securityScanLanguageIds = [
263263
'java',
264264
'python',
265265
'javascript',
266+
'javascriptreact',
266267
'typescript',
268+
'typescriptreact',
267269
'csharp',
268270
'go',
269271
'ruby',
@@ -286,6 +288,11 @@ export const securityScanLanguageIds = [
286288
'java-properties',
287289
'go.mod',
288290
'go.sum',
291+
'kotlin',
292+
'scala',
293+
'sh',
294+
'shell',
295+
'shellscript',
289296
] as const
290297

291298
export type SecurityScanLanguageId = (typeof securityScanLanguageIds)[number]

packages/core/src/codewhisperer/util/securityScanLanguageContext.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export class SecurityScanLanguageContext {
1717
java: 'java',
1818
python: 'python',
1919
javascript: 'javascript',
20+
javascriptreact: 'javascript',
2021
typescript: 'typescript',
22+
typescriptreact: 'typescript',
2123
csharp: 'csharp',
2224
go: 'go',
2325
golang: 'go',
@@ -40,6 +42,11 @@ export class SecurityScanLanguageContext {
4042
'java-properties': 'plaintext',
4143
'go.mod': 'plaintext',
4244
'go.sum': 'plaintext',
45+
kotlin: 'kotlin',
46+
scala: 'scala',
47+
sh: 'shell',
48+
shell: 'shell',
49+
shellscript: 'shell',
4350
})
4451
}
4552

0 commit comments

Comments
 (0)