diff --git a/packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json b/packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json
new file mode 100644
index 00000000000..7e59d131c8d
--- /dev/null
+++ b/packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json
@@ -0,0 +1,4 @@
+{
+ "type": "Bug Fix",
+ "description": "/transform: only show lines of code statistic in plan"
+}
diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
index 7c520786869..e284207540d 100644
--- a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
+++ b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
@@ -595,9 +595,11 @@ export function getJobStatisticsHtml(jobStatistics: any) {
htmlString += `
`
// eslint-disable-next-line unicorn/no-array-for-each
jobStatistics.forEach((stat: { name: string; value: string }) => {
- htmlString += `
${getFormattedString(stat.name)}: ${stat.value}
`
+ if (stat.name === 'linesOfCode') {
+ htmlString += `
${getFormattedString(stat.name)}: ${stat.value}
`
+ }
})
htmlString += `
`
return htmlString
@@ -647,8 +649,6 @@ export async function getTransformationPlan(jobId: string, profile: RegionProfil
plan += `
`
}
plan += `
`
- plan += `Appendix
Scroll to top 
`
- plan = addTableMarkdown(plan, '-1', tableMapping) // ID of '-1' reserved for appendix table; only 1 table there
return plan
} catch (e: any) {
const errorMessage = (e as Error).message
diff --git a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts
index 369fa1ec67e..edb2524ee68 100644
--- a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts
+++ b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts
@@ -28,6 +28,7 @@ import {
zipCode,
getTableMapping,
getFilesRecursively,
+ getJobStatisticsHtml,
} from '../../../codewhisperer/service/transformByQ/transformApiHandler'
import {
validateOpenProjects,
@@ -312,6 +313,31 @@ dependencyManagement:
assert.deepStrictEqual(actual, expected)
})
+ it('WHEN showing plan statistics THEN correct labels appear', () => {
+ const mockJobStatistics = [
+ {
+ name: 'linesOfCode',
+ value: '1234',
+ },
+ {
+ name: 'plannedDependencyChanges',
+ value: '0',
+ },
+ {
+ name: 'plannedDeprecatedApiChanges',
+ value: '0',
+ },
+ {
+ name: 'plannedFileChanges',
+ value: '0',
+ },
+ ]
+ const result = getJobStatisticsHtml(mockJobStatistics)
+ assert.strictEqual(result.includes('Lines of code in your application'), true)
+ assert.strictEqual(result.includes('to be replaced'), false)
+ assert.strictEqual(result.includes('to be changed'), false)
+ })
+
it(`WHEN transforming a project with a Windows Maven executable THEN mavenName set correctly`, async function () {
sinon.stub(env, 'isWin').returns(true)
const tempFileName = 'mvnw.cmd'