From 5b59c281b98843e7dbddc264432679d22342dce9 Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Tue, 8 Aug 2023 11:51:21 +0200 Subject: [PATCH] chore: make linter happy --- .../snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt | 5 +++-- .../io/snyk/plugin/cli/ConsoleCommandRunnerTest.kt | 2 +- .../plugin/core/IgnoreInfoHolderPlatformTestCase.kt | 6 +++--- .../snyk/container/ContainerBulkFileListenerTest.kt | 11 +++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt index c6ed1d8d5..a67910c49 100644 --- a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt +++ b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt @@ -107,8 +107,9 @@ class SnykTreeCellRenderer : ColoredTreeCellRenderer() { } is IacFileTreeNode -> { val iacVulnerabilitiesForFile = value.userObject as IacIssuesForFile - nodeIcon = - PackageManagerIconProvider.getIcon(iacVulnerabilitiesForFile.packageManager.lowercase(Locale.getDefault())) + nodeIcon = PackageManagerIconProvider.getIcon( + iacVulnerabilitiesForFile.packageManager.lowercase(Locale.getDefault()) + ) text = iacVulnerabilitiesForFile.targetFile + ProductType.IAC.getCountText(value.childCount) val snykCachedResults = getSnykCachedResults(value.project) diff --git a/src/test/kotlin/io/snyk/plugin/cli/ConsoleCommandRunnerTest.kt b/src/test/kotlin/io/snyk/plugin/cli/ConsoleCommandRunnerTest.kt index e415c146b..2c17a426c 100644 --- a/src/test/kotlin/io/snyk/plugin/cli/ConsoleCommandRunnerTest.kt +++ b/src/test/kotlin/io/snyk/plugin/cli/ConsoleCommandRunnerTest.kt @@ -190,7 +190,7 @@ class ConsoleCommandRunnerTest : LightPlatformTestCase() { val generalCommandLine = GeneralCommandLine("") val expectedProxy = - "http://${encodedLogin}:${encodedPassword}@" + + "http://$encodedLogin:$encodedPassword@" + "${httpConfigurable.PROXY_HOST}:${httpConfigurable.PROXY_PORT}" ConsoleCommandRunner().setupCliEnvironmentVariables(generalCommandLine, "") diff --git a/src/test/kotlin/io/snyk/plugin/core/IgnoreInfoHolderPlatformTestCase.kt b/src/test/kotlin/io/snyk/plugin/core/IgnoreInfoHolderPlatformTestCase.kt index 9dab77fdc..d6d88285e 100644 --- a/src/test/kotlin/io/snyk/plugin/core/IgnoreInfoHolderPlatformTestCase.kt +++ b/src/test/kotlin/io/snyk/plugin/core/IgnoreInfoHolderPlatformTestCase.kt @@ -116,9 +116,9 @@ class IgnoreInfoHolderPlatformTestCase : HeavyPlatformTestCase() { private fun setUpTest(): SnykCodeFile { val filePathToCheck = project.basePath + "/node_modules/1.js" - File(filePathToCheck).parentFile.mkdirs() - && File(filePathToCheck).createNewFile() - || throw IOException("Failed to create file $filePathToCheck") + File(filePathToCheck).parentFile.mkdirs() && + File(filePathToCheck).createNewFile() || + throw IOException("Failed to create file $filePathToCheck") val fileToCheck = findFile(project, filePathToCheck) initiateAllMissedIgnoreFilesRescan() diff --git a/src/test/kotlin/snyk/container/ContainerBulkFileListenerTest.kt b/src/test/kotlin/snyk/container/ContainerBulkFileListenerTest.kt index 8bcd70fc0..5b8820961 100644 --- a/src/test/kotlin/snyk/container/ContainerBulkFileListenerTest.kt +++ b/src/test/kotlin/snyk/container/ContainerBulkFileListenerTest.kt @@ -28,7 +28,6 @@ import java.nio.file.Paths import java.util.concurrent.TimeUnit import kotlin.io.path.notExists -@Suppress("FunctionName") class ContainerBulkFileListenerTest : BasePlatformTestCase() { override fun setUp() { @@ -49,17 +48,17 @@ class ContainerBulkFileListenerTest : BasePlatformTestCase() { imageCache.clear() } - private fun createNewFileInProjectRoot(name: String): File { + private fun createNewFileInProjectRoot(): File { val projectPath = Paths.get(project.basePath!!) if (projectPath.notExists(LinkOption.NOFOLLOW_LINKS)) { projectPath.createDirectories() } - return File(project.basePath + File.separator + name).apply { createNewFile() } + return File(project.basePath + File.separator + "kubernetes-test.yaml").apply { createNewFile() } } fun `test Container should update image cache when yaml file is changed`() { setUpContainerTest() - val path = createNewFileInProjectRoot("kubernetes-test.yaml").toPath() + val path = createNewFileInProjectRoot().toPath() Files.write(path, "\n".toByteArray(Charsets.UTF_8)) val virtualFile = VirtualFileManager.getInstance().findFileByNioPath(path) require(virtualFile != null) @@ -289,7 +288,7 @@ class ContainerBulkFileListenerTest : BasePlatformTestCase() { createFakeContainerResultInCache(psiFile) assertFalse(isContainerUpdateNeeded()) - var exceptionThrown = false + val exceptionThrown: Boolean val messageBusConnection = ApplicationManager.getApplication().messageBus.connect() try { messageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, ExceptionProducerFileListener()) @@ -300,7 +299,7 @@ class ContainerBulkFileListenerTest : BasePlatformTestCase() { exceptionThrown = try { FileDocumentManager.getInstance().saveAllDocuments() false - } catch (e: RuntimeException) { + } catch (ignored: RuntimeException) { true } } finally {