Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Adamczyk committed Dec 22, 2020
1 parent aeb80e4 commit b1daf13
Show file tree
Hide file tree
Showing 147 changed files with 221 additions and 235 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks {
exclude(
"**/*Generated.kt",
"**/*Test.kt",
"**/Test*.kt" //we can expand this list
"**/Test*.kt" // we can expand this list
)
}
}
Expand Down
2 changes: 0 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,3 @@ object Dependencies {
const val GLASSFISH_JSON = "org.glassfish:javax.json:${Versions.GLASSFISH_JSON}"
//endregion
}


2 changes: 1 addition & 1 deletion common/src/main/kotlin/flank.common/Archive.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package flank.common

import java.io.File
import org.rauschig.jarchivelib.ArchiveFormat
import org.rauschig.jarchivelib.ArchiverFactory
import org.rauschig.jarchivelib.CompressionType
import java.io.File

fun File.extract(
destination: File,
Expand Down
8 changes: 4 additions & 4 deletions common/src/test/kotlin/flank/common/FilesTest.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package flank.common

import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
import org.junit.After
import org.junit.Assert.assertTrue
import org.junit.Assume.assumeFalse
import org.junit.Test
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths

class FileKtTest {
class FilesTest {

private val linkName = "tmp"
private val targetName = "../"
Expand Down
2 changes: 1 addition & 1 deletion common/src/test/kotlin/flank/common/ZipTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package flank.common

import java.io.File
import org.junit.Assert
import org.junit.Test
import java.io.File

internal class ArchiveKtTest {

Expand Down
2 changes: 1 addition & 1 deletion flank-actions/common.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Common {
const val EXIT_CODE_SUCCESS = 0
const val EXIT_CODE_FAILURE = -1
const val URL_SLACK ="https://slack.com/api/chat.postMessage"
const val URL_SLACK = "https://slack.com/api/chat.postMessage"
const val ARGS_TOKEN = 0
const val ARGS_CHANNEL = 1
const val ARGS_MESSAGE = 2
Expand Down
9 changes: 4 additions & 5 deletions flank-actions/sendMessage.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import kotlin.system.exitProcess

// DEPS com.github.kittinunf.fuel:fuel:2.3.0

//DEPS com.github.kittinunf.fuel:fuel:2.3.0

//INCLUDE slackService.kt
//INCLUDE common.kt
// INCLUDE slackService.kt
// INCLUDE common.kt

val result = sendMessage(args)

println("Message has been sent with result $result")

if (result != 0){
if (result != 0) {
exitProcess(result)
}
9 changes: 4 additions & 5 deletions flank-actions/slackService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.core.Headers

fun sendMessage(args: Array<String>): Int{
fun sendMessage(args: Array<String>): Int {
val token = args[Common.ARGS_TOKEN]
val channel = args[Common.ARGS_CHANNEL]
val message = args[Common.ARGS_MESSAGE]
val cookie = args[Common.ARGS_COOKIE]

return try {
val (req, rep, res) = Fuel.get(Common.URL_SLACK,
listOf("token" to token,"channel" to channel,"text" to message))
val (req, rep, res) = Fuel.get(Common.URL_SLACK,
listOf("token" to token, "channel" to channel, "text" to message))
.header(Headers.COOKIE to cookie)
.responseString()

Common.EXIT_CODE_SUCCESS
}
catch(e: Exception) {
} catch (e: Exception) {
Common.EXIT_CODE_FAILURE
}
}
10 changes: 5 additions & 5 deletions flank-scripts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.jfrog.bintray.gradle.BintrayExtension
import java.util.*
import java.nio.file.Paths
import groovy.xml.dom.DOMCategory.attributes
import java.io.ByteArrayOutputStream
import java.nio.file.Paths
import java.util.*

plugins {
application
Expand Down Expand Up @@ -97,7 +98,6 @@ tasks.test {
minHeapSize = "512m"
}


repositories {
jcenter()
mavenCentral()
Expand Down Expand Up @@ -142,8 +142,8 @@ val checkIfVersionUpdated by tasks.registering(Exec::class) {
doLast {
val changedFiles = execAndGetStdout("git", "diff", "origin/master", "HEAD", "--name-only").split("\n") +
execAndGetStdout("git", "diff", "origin/master", "--name-only").split("\n")
val isVersionChanged = changedFiles.any { it.startsWith("flank-scripts") }.not()
|| (changedFiles.contains("flank-scripts/build.gradle.kts") && isVersionChangedInBuildGradle())
val isVersionChanged = changedFiles.any { it.startsWith("flank-scripts") }.not() ||
(changedFiles.contains("flank-scripts/build.gradle.kts") && isVersionChangedInBuildGradle())

if (isVersionChanged.not()) {
throw GradleException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.kittinunf.result.Result
import flank.scripts.github.getLatestReleaseTag
import kotlinx.coroutines.runBlocking
import kotlin.system.exitProcess
import kotlinx.coroutines.runBlocking

class NextReleaseTagCommand : CliktCommand(help = "Print next release tag", name = "nextReleaseTag") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import flank.scripts.github.objects.GithubPullRequest
import flank.scripts.github.objects.GithubUser
import flank.scripts.utils.markdownLink
import flank.scripts.utils.runCommand
import java.io.File
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.runBlocking
import java.io.File

fun generateReleaseNotes(githubToken: String) = runBlocking {
generateReleaseNotes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import com.github.kittinunf.result.map
import com.github.kittinunf.result.success
import flank.scripts.ci.nexttag.generateNextReleaseTag
import flank.scripts.github.getLatestReleaseTag
import kotlinx.coroutines.runBlocking
import java.io.File
import kotlinx.coroutines.runBlocking

class GenerateReleaseNotesCommand :
CliktCommand("Command to append item to release notes", name = "generateReleaseNotes") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import flank.scripts.github.patchIssue
import flank.scripts.github.postNewIssue
import flank.scripts.github.postNewIssueComment
import flank.scripts.utils.toJson
import kotlinx.coroutines.coroutineScope
import kotlin.system.exitProcess
import kotlinx.coroutines.coroutineScope

internal suspend fun IntegrationContext.createNewIssue(): GitHubCreateIssueCommentRequest =
createAndPostNewIssue().postComment()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.github.ajalt.clikt.parameters.options.required
import com.github.kittinunf.result.Result
import flank.scripts.utils.ERROR_WHEN_RUNNING
import flank.scripts.utils.SUCCESS
import kotlinx.coroutines.runBlocking
import kotlin.system.exitProcess
import kotlinx.coroutines.runBlocking

class UpdateBugSnagCommand : CliktCommand(name = "updateBugsnag", help = "Update Bugnsag") {

Expand Down
4 changes: 2 additions & 2 deletions flank-scripts/src/test/kotlin/flank/common/FilesTest.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package flank.common

import org.junit.Assert
import org.junit.Test
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
import org.junit.Assert
import org.junit.Test

internal class FilesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import io.mockk.coEvery
import io.mockk.every
import io.mockk.mockkStatic
import io.mockk.unmockkAll
import java.time.LocalDate
import java.time.Year
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemOutRule
import org.junit.runner.RunWith
import java.time.LocalDate
import java.time.Year

@RunWith(FuelTestRunner::class)
class NextReleaseTagCommandTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package flank.scripts.ci.nexttag
import com.google.common.truth.Truth.assertThat
import io.mockk.every
import io.mockk.mockkStatic
import java.time.LocalDate
import org.junit.BeforeClass
import org.junit.Test
import java.time.LocalDate

class NextReleaseTagGeneratorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package flank.scripts.ci.releasenotes
import com.google.common.truth.Truth.assertThat
import flank.scripts.utils.markdownH2
import flank.scripts.utils.markdownH3
import org.junit.Test
import java.io.File
import org.junit.Test

class AppendReleaseNotesTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package flank.scripts.ci.releasenotes

import com.google.common.truth.Truth.assertThat
import org.junit.Test
import java.io.File
import org.junit.Test

class GenerateReleaseNotesCommandTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package flank.scripts.dependencies.update

import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Test
import skipIfWindows
import java.io.File

class UpdateDependenciesTest {
private val testReport = File("src/test/kotlin/flank/scripts/dependencies/update/testfiles/report.json")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package flank.scripts.dependencies.update

import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import java.io.File

@RunWith(Parameterized::class)
class UpdateGradleTest(private val settings: List<TestChannelSettings>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package flank.scripts.dependencies.update

import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Test
import skipIfWindows
import java.io.File

class UpdatePluginsTest {
private val testReport = File("src/test/kotlin/flank/scripts/dependencies/update/testfiles/report.json")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package flank.scripts.dependencies.update

import flank.scripts.utils.toDependencyUpdate
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Test
import skipIfWindows
import java.io.File

class UpdateVersionsInFileTest {

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ compileTestKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
}
// Locally you should have flank built already, on CI we need to build it
if(System.getenv("CI") != null) {
if (System.getenv("CI") != null) {
tasks["integrationTests"].dependsOn(":test_runner:build")
}
2 changes: 1 addition & 1 deletion integration_tests/src/test/kotlin/FlankCommand.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import utils.runCommand
import java.io.File
import utils.runCommand

data class FlankCommand(val flankPath: String, val ymlPath: String, val params: List<String>)

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/test/kotlin/IntegrationTests.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Ignore
Expand All @@ -8,7 +9,6 @@ import utils.findTestDirectoryFromOutput
import utils.loadAsTestSuite
import utils.toJUnitXmlFile
import utils.toStringMap
import java.io.File

class IntegrationTests {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package integration

import com.google.common.truth.Truth.assertThat
import java.io.File
import org.junit.Assert.assertEquals
import utils.ProcessResult
import java.io.File

const val FLANK_JAR_PATH = "../test_runner/build/libs/flank.jar"
const val CONFIGS_PATH = "./src/test/resources/cases"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/test/kotlin/utils/LoadTestSuites.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package utils

import com.fasterxml.jackson.dataformat.xml.XmlMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
import utils.testResults.TestSuites
import java.io.File
import utils.testResults.TestSuites

fun File.loadAsTestSuite(): TestSuites =
XmlMapper().registerModule(KotlinModule()).readValue(this, TestSuites::class.java)
4 changes: 2 additions & 2 deletions integration_tests/src/test/kotlin/utils/OutputHelper.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package utils

import java.io.File
import java.nio.file.Paths
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import utils.testResults.TestSuites
import java.io.File
import java.nio.file.Paths

fun String.findTestDirectoryFromOutput() =
"results-dir:\\s.*\\s".toRegex().find(this)?.value.orEmpty().trim().replace("results-dir: ", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package ftl.sample

import java.time.Duration
import okhttp3.Authenticator
import okhttp3.Credentials
import okhttp3.OkHttpClient
Expand All @@ -11,7 +12,6 @@ import okhttp3.Route
import okhttp3.sse.EventSource
import okhttp3.sse.EventSourceListener
import okhttp3.sse.EventSources.createFactory
import java.time.Duration

fun main() {
val id = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.example.test_app.similar

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.test_app.BaseInstrumentedTest
import org.junit.Ignore
import androidx.test.filters.Suppress
import org.junit.Test
import org.junit.runner.RunWith

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.example.test_app.similar

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.test_app.BaseInstrumentedTest
import org.junit.Ignore
import androidx.test.filters.Suppress
import org.junit.Test
import org.junit.runner.RunWith

Expand Down
Loading

0 comments on commit b1daf13

Please sign in to comment.