Skip to content

Commit

Permalink
feat(amazonq): add new languages for auto scan (#5934)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
ctlai95 authored Nov 6, 2024
1 parent 2c356e3 commit 6989ed6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Security Scan: Auto-scan now supports JSX, TSX, Kotlin, Scala, and Shell files."
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ describe('securityScanLanguageContext', function () {
['javascript', true],
['typescript', true],
['jsx', false],
['javascriptreact', false],
['typescriptreact', false],
['javascriptreact', true],
['typescriptreact', true],
['tsx', false],
['csharp', true],
['python', true],
['c', true],
['cpp', true],
['go', true],
['kotlin', false],
['kotlin', true],
['php', true],
['ruby', true],
['rust', false],
['scala', false],
['shellscript', false],
['scala', true],
['shellscript', true],
['sql', false],
['json', true],
['yaml', true],
Expand Down Expand Up @@ -92,7 +92,9 @@ describe('securityScanLanguageContext', function () {
['java', 'java'],
['python', 'python'],
['javascript', 'javascript'],
['javascriptreact', 'javascript'],
['typescript', 'typescript'],
['typescriptreact', 'typescript'],
['csharp', 'csharp'],
['go', 'go'],
['ruby', 'ruby'],
Expand All @@ -112,6 +114,9 @@ describe('securityScanLanguageContext', function () {
['java-properties', 'plaintext'],
['go.mod', 'plaintext'],
['go.sum', 'plaintext'],
['kotlin', 'kotlin'],
['scala', 'scala'],
['shellscript', 'shell'],
]

for (const [securityScanLanguageId, expectedCwsprLanguageId] of securityScanLanguageIds) {
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/codewhisperer/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ export const securityScanLanguageIds = [
'java',
'python',
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'csharp',
'go',
'ruby',
Expand All @@ -286,6 +288,11 @@ export const securityScanLanguageIds = [
'java-properties',
'go.mod',
'go.sum',
'kotlin',
'scala',
'sh',
'shell',
'shellscript',
] as const

export type SecurityScanLanguageId = (typeof securityScanLanguageIds)[number]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export class SecurityScanLanguageContext {
java: 'java',
python: 'python',
javascript: 'javascript',
javascriptreact: 'javascript',
typescript: 'typescript',
typescriptreact: 'typescript',
csharp: 'csharp',
go: 'go',
golang: 'go',
Expand All @@ -40,6 +42,11 @@ export class SecurityScanLanguageContext {
'java-properties': 'plaintext',
'go.mod': 'plaintext',
'go.sum': 'plaintext',
kotlin: 'kotlin',
scala: 'scala',
sh: 'shell',
shell: 'shell',
shellscript: 'shell',
})
}

Expand Down

0 comments on commit 6989ed6

Please sign in to comment.