Skip to content

Commit 3ffa4f9

Browse files
author
David Hasani
committed
fix detekt again
1 parent 7803b0a commit 3ffa4f9

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerSession.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class CodeModernizerSession(
338338
fun resumeTransformation() {
339339
val clientAdaptor = GumbyClient.getInstance(sessionContext.project)
340340
clientAdaptor.resumeCodeTransformation(state.currentJobId as JobId, TransformationUserActionStatus.COMPLETED)
341-
getLogger<CodeModernizerManager>().info("Successfully resumed transformation with status of COMPLETED")
341+
getLogger<CodeModernizerManager>().info { "Successfully resumed transformation with status of COMPLETED" }
342342
}
343343

344344
fun rejectHilAndContinue(): ResumeTransformationResponse {

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformApiUtils.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ import software.amazon.awssdk.services.codewhispererruntime.model.ValidationExce
3636
import software.amazon.awssdk.services.ssooidc.model.InvalidGrantException
3737
import software.aws.toolkits.core.utils.WaiterUnrecoverableException
3838
import software.aws.toolkits.core.utils.Waiters.waitUntil
39+
import software.aws.toolkits.core.utils.error
3940
import software.aws.toolkits.core.utils.getLogger
41+
import software.aws.toolkits.core.utils.info
4042
import software.aws.toolkits.jetbrains.core.coroutines.EDT
4143
import software.aws.toolkits.jetbrains.services.codemodernizer.CodeModernizerManager
4244
import software.aws.toolkits.jetbrains.services.codemodernizer.CodeTransformTelemetryManager
@@ -172,22 +174,22 @@ suspend fun JobId.pollTransformationStatusAndPlan(
172174

173175
suspend fun attemptLocalBuild(plan: TransformationPlan, jobId: JobId, project: Project) {
174176
val artifactId = getClientInstructionArtifactId(plan)
175-
getLogger<CodeModernizerManager>().info("Found artifactId: $artifactId")
177+
getLogger<CodeModernizerManager>().info { "Found artifactId: $artifactId" }
176178
if (artifactId != null) {
177179
val clientInstructionsPath = downloadClientInstructions(jobId, artifactId, project)
178-
getLogger<CodeModernizerManager>().info("Downloaded client instructions for job ${jobId.id} and artifact $artifactId at: $clientInstructionsPath")
180+
getLogger<CodeModernizerManager>().info { "Downloaded client instructions for job ${jobId.id} and artifact $artifactId at: $clientInstructionsPath" }
179181
processClientInstructions(clientInstructionsPath, jobId, artifactId, project)
180-
getLogger<CodeModernizerManager>().info("Finished processing client instructions for job ${jobId.id} and artifact $artifactId")
182+
getLogger<CodeModernizerManager>().info { "Finished processing client instructions for job ${jobId.id} and artifact $artifactId" }
181183
}
182184
}
183185

184186
suspend fun processClientInstructions(clientInstructionsPath: Path, jobId: JobId, artifactId: String, project: Project) {
185187
var copyOfProjectSources = createTempDirectory("originalCopy_${jobId.id}_$artifactId", null).toPath()
186-
getLogger<CodeModernizerManager>().info("About to copy the original project ZIP to: $copyOfProjectSources")
188+
getLogger<CodeModernizerManager>().info { "About to copy the original project ZIP to: $copyOfProjectSources" }
187189
val originalProjectZip = CodeModernizerManager.getInstance(project).codeTransformationSession?.sessionContext?.originalUploadZipPath
188190
originalProjectZip?.let { unzipFile(it, copyOfProjectSources, isSqlMetadata = false, extractOnlySources = true) }
189191
copyOfProjectSources = copyOfProjectSources.resolve("sources") // where the user's source code is within the upload ZIP
190-
getLogger<CodeModernizerManager>().info("Copied and unzipped original project sources to: $copyOfProjectSources")
192+
getLogger<CodeModernizerManager>().info { "Copied and unzipped original project sources to: $copyOfProjectSources" }
191193

192194
val targetDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(copyOfProjectSources.toFile())
193195
?: throw RuntimeException("Cannot find copy of project sources directory")
@@ -217,16 +219,16 @@ suspend fun processClientInstructions(clientInstructionsPath: Path, jobId: JobId
217219
null,
218220
null
219221
).execute()
220-
getLogger<CodeModernizerManager>().info("Successfully applied patch file at $clientInstructionsPath")
222+
getLogger<CodeModernizerManager>().info { "Successfully applied patch file at $clientInstructionsPath" }
221223

222224
val virtualFile = LocalFileSystem.getInstance().findFileByIoFile(clientInstructionsPath.toFile())
223225
?: throw RuntimeException("Cannot find patch file at $clientInstructionsPath")
224226
FileEditorManager.getInstance(project).openFile(virtualFile, true)
225227
} catch (e: Exception) {
226-
getLogger<CodeModernizerManager>().error(
228+
getLogger<CodeModernizerManager>().error {
227229
"Error applying intermediate diff.patch for job ${jobId.id} and artifact $artifactId located at " +
228230
"$clientInstructionsPath: $e"
229-
)
231+
}
230232
} finally {
231233
runWriteAction {
232234
ModuleManager.getInstance(project).disposeModule(tempModule)
@@ -236,21 +238,21 @@ suspend fun processClientInstructions(clientInstructionsPath: Path, jobId: JobId
236238
}
237239

238240
val (exitCode, buildOutput) = runClientSideBuild(targetDir, CodeModernizerManager.LOG, project)
239-
getLogger<CodeModernizerManager>().info("Ran client-side build with an exit code of $exitCode")
241+
getLogger<CodeModernizerManager>().info { "Ran client-side build with an exit code of $exitCode" }
240242
val uploadZip = createClientSideBuildUploadZip(exitCode, buildOutput)
241-
getLogger<CodeModernizerManager>().info("Created client-side build result upload zip for job ${jobId.id} and artifact $artifactId: ${uploadZip.path}")
243+
getLogger<CodeModernizerManager>().info { "Created client-side build result upload zip for job ${jobId.id} and artifact $artifactId: ${uploadZip.path}" }
242244
val uploadContext = UploadContext.fromTransformationUploadContext(
243245
TransformationUploadContext.builder().jobId(jobId.id).uploadArtifactType("ClientBuildResult").build()
244246
)
245247
getLogger<CodeModernizerManager>().info("About to call uploadPayload for job ${jobId.id} and artifact $artifactId")
246248
try {
247249
CodeModernizerManager.getInstance(project).codeTransformationSession?.uploadPayload(uploadZip, uploadContext)
248-
getLogger<CodeModernizerManager>().info("Upload succeeded; about to call ResumeTransformation for job ${jobId.id} and artifact $artifactId now")
250+
getLogger<CodeModernizerManager>().info { "Upload succeeded; about to call ResumeTransformation for job ${jobId.id} and artifact $artifactId now" }
249251
CodeModernizerManager.getInstance(project).codeTransformationSession?.resumeTransformation()
250252
} finally {
251253
uploadZip.deleteRecursively()
252254
copyOfProjectSources.toFile().deleteRecursively()
253-
getLogger<CodeModernizerManager>().info("Deleted copy of project sources and client-side build upload ZIP")
255+
getLogger<CodeModernizerManager>().info { "Deleted copy of project sources and client-side build upload ZIP" }
254256
}
255257
// switch back to Transformation Hub view
256258
runInEdt {

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/utils/CodeTransformFileUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fun parseXmlDependenciesReport(pathToXmlDependency: Path): DependencyUpdatesRepo
198198

199199
fun validateCustomVersionsFile(file: VirtualFile): Boolean {
200200
if (!file.name.lowercase().endsWith(".yaml")) {
201-
getLogger<CodeTransformChatController>().error { "Custom versions file is not a YAML file: ${file.name}"}
201+
getLogger<CodeTransformChatController>().error { "Custom versions file is not a YAML file: ${file.name}" }
202202
return false
203203
}
204204
val fileContents = file.readText()

plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerUtilsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getTableMap
3434
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.parseBuildFile
3535
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.pollTransformationStatusAndPlan
3636
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.refreshToken
37-
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.validateSctMetadata
3837
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.validateCustomVersionsFile
38+
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.validateSctMetadata
3939
import software.aws.toolkits.jetbrains.utils.notifyStickyWarn
4040
import software.aws.toolkits.jetbrains.utils.rules.addFileToModule
4141
import software.aws.toolkits.resources.message

0 commit comments

Comments
 (0)