Skip to content

Commit

Permalink
chore: make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Aug 8, 2023
1 parent 225266a commit 5b59c28
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 5 additions & 6 deletions src/test/kotlin/snyk/container/ContainerBulkFileListenerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down Expand Up @@ -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())
Expand All @@ -300,7 +299,7 @@ class ContainerBulkFileListenerTest : BasePlatformTestCase() {
exceptionThrown = try {
FileDocumentManager.getInstance().saveAllDocuments()
false
} catch (e: RuntimeException) {
} catch (ignored: RuntimeException) {
true
}
} finally {
Expand Down

0 comments on commit 5b59c28

Please sign in to comment.