From ffb04c8025ba68402b950589cb7afea71e4dd206 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 13 Jun 2025 15:50:39 -0700 Subject: [PATCH 1/5] fix(amazonq): only show lines of code --- .../Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json | 4 ++++ .../service/transformByQ/transformApiHandler.ts | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json 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 From 735f694cfb2069946fa49af9506003bab7de16b4 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 13 Jun 2025 15:53:55 -0700 Subject: [PATCH 2/5] remove changelog --- .../Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json 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 deleted file mode 100644 index 7e59d131c8d..00000000000 --- a/packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "Bug Fix", - "description": "/transform: only show lines of code statistic in plan" -} From e5b0cab073ff3cf76c07189d2d512f0b24dfe350 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 13 Jun 2025 15:55:38 -0700 Subject: [PATCH 3/5] add back changelog --- .../Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/amazonq/.changes/next-release/Bug Fix-665b0f02-d6fe-4cfc-ac52-564f35d12aa5.json 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" +} From aa81c355d7755d9234bded9e5a2e9e742c8cd813 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 13 Jun 2025 16:11:09 -0700 Subject: [PATCH 4/5] add test --- .../commands/transformByQ.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts index 369fa1ec67e..2f817148f55 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: '1000', + }, + { + name: 'plannedDependencyChanges', + value: '5', + }, + { + name: 'plannedDeprecatedApiChanges', + value: '10', + }, + { + name: 'plannedFileChanges', + value: '7', + }, + ] + 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' From 6eb74ad3b00cfd829e10766433f08a69e40c42d5 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 13 Jun 2025 16:12:34 -0700 Subject: [PATCH 5/5] update test --- .../src/test/codewhisperer/commands/transformByQ.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts index 2f817148f55..edb2524ee68 100644 --- a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts +++ b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts @@ -317,19 +317,19 @@ dependencyManagement: const mockJobStatistics = [ { name: 'linesOfCode', - value: '1000', + value: '1234', }, { name: 'plannedDependencyChanges', - value: '5', + value: '0', }, { name: 'plannedDeprecatedApiChanges', - value: '10', + value: '0', }, { name: 'plannedFileChanges', - value: '7', + value: '0', }, ] const result = getJobStatisticsHtml(mockJobStatistics)