Skip to content

Commit 3e875a9

Browse files
committed
Reformat code using editorconfig
1 parent 69d5765 commit 3e875a9

24 files changed

Lines changed: 137 additions & 124 deletions

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
ij_kotlin_call_parameters_new_line_after_left_paren = false
8+
ij_kotlin_call_parameters_right_paren_on_new_line = false
9+
ij_kotlin_method_parameters_new_line_after_left_paren = false
10+
ij_kotlin_method_parameters_right_paren_on_new_line = false
11+
ij_any_wrap_long_lines = false
12+
ij_formatter_off_tag = "@formatter:off"
13+
ij_formatter_on_tag = "@formatter:on"
14+
max_line_length = 256
15+
16+
[*.{java,xml,yaml}]
17+
indent_style = space
18+
indent_size = 4
19+
charset = utf-8
20+
21+
[*.gradle]
22+
indent_style = tab
23+
24+
[Jenkinsfile}]
25+
indent_style = space
26+
indent_size = 4
27+
charset = utf-8

src/main/kotlin/eu/openanalytics/shinyproxyoperator/Operator.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import kotlinx.coroutines.channels.Channel
4949
import kotlinx.coroutines.channels.SendChannel
5050
import mu.KotlinLogging
5151
import org.slf4j.LoggerFactory
52-
import java.lang.IllegalStateException
5352
import kotlin.system.exitProcess
5453

5554

@@ -74,11 +73,11 @@ class Operator(client: NamespacedKubernetesClient? = null,
7473
val startupProbeInitialDelay: Int
7574

7675
private val podSetCustomResourceDefinitionContext = CustomResourceDefinitionContext.Builder()
77-
.withVersion("v1alpha1")
78-
.withScope("Namespaced")
79-
.withGroup("openanalytics.eu")
80-
.withPlural("shinyproxies")
81-
.build()
76+
.withVersion("v1alpha1")
77+
.withScope("Namespaced")
78+
.withGroup("openanalytics.eu")
79+
.withPlural("shinyproxies")
80+
.build()
8281

8382
private val informerFactory: SharedInformerFactory
8483
private val replicaSetInformer: SharedIndexInformer<ReplicaSet>
@@ -238,7 +237,7 @@ class Operator(client: NamespacedKubernetesClient? = null,
238237

239238
fun setOperatorInstance(operator: Operator) {
240239
this._operatorInstance = operator
241-
}
240+
}
242241

243242
fun getOperatorInstance(): Operator {
244243
_operatorInstance.let {
@@ -251,7 +250,7 @@ class Operator(client: NamespacedKubernetesClient? = null,
251250
}
252251
}
253252

254-
private fun<T> readConfigValue(constructorValue: T?, default: T, envVarName: String, convertor: (String) -> T): T {
253+
private fun <T> readConfigValue(constructorValue: T?, default: T, envVarName: String, convertor: (String) -> T): T {
255254
val e = System.getenv(envVarName)
256255
val res = when {
257256
constructorValue != null -> constructorValue
@@ -267,4 +266,4 @@ class Operator(client: NamespacedKubernetesClient? = null,
267266
enum class Mode {
268267
CLUSTERED,
269268
NAMESPACED
270-
}
269+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ConfigMapFactory.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2525
import io.fabric8.kubernetes.api.model.ConfigMap
2626
import io.fabric8.kubernetes.api.model.ConfigMapBuilder
2727
import io.fabric8.kubernetes.client.KubernetesClient
28-
import io.fabric8.kubernetes.client.KubernetesClientException
2928
import mu.KotlinLogging
3029

3130

@@ -60,4 +59,4 @@ class ConfigMapFactory(private val kubeClient: KubernetesClient) {
6059
logger.debug { "${shinyProxy.logPrefix(shinyProxyInstance)} [Component/ConfigMap] Created ${createdConfigMap.metadata.name}" }
6160
}
6261

63-
}
62+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/LabelFactory.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,31 @@ package eu.openanalytics.shinyproxyoperator.components
2222

2323
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2424
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
25-
import java.lang.RuntimeException
2625

2726
object LabelFactory {
2827

2928
fun labelsForCurrentShinyProxyInstance(shinyProxy: ShinyProxy): Map<String, String> {
3029
return mapOf(
31-
APP_LABEL to APP_LABEL_VALUE,
32-
NAME_LABEL to shinyProxy.metadata.name,
33-
INSTANCE_LABEL to shinyProxy.hashOfCurrentSpec
30+
APP_LABEL to APP_LABEL_VALUE,
31+
NAME_LABEL to shinyProxy.metadata.name,
32+
INSTANCE_LABEL to shinyProxy.hashOfCurrentSpec
3433
)
3534
}
36-
35+
3736
fun labelsForShinyProxyInstance(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance): Map<String, String> {
3837
val hashOfSpec = shinyProxyInstance.hashOfSpec
3938
return mapOf(
40-
APP_LABEL to APP_LABEL_VALUE,
41-
NAME_LABEL to shinyProxy.metadata.name,
42-
INSTANCE_LABEL to hashOfSpec
39+
APP_LABEL to APP_LABEL_VALUE,
40+
NAME_LABEL to shinyProxy.metadata.name,
41+
INSTANCE_LABEL to hashOfSpec
4342
)
4443
}
4544

4645
const val APP_LABEL = "app"
4746
const val APP_LABEL_VALUE = "shinyproxy"
4847
const val NAME_LABEL = "openanalytics.eu/sp-resource-name"
4948
const val INSTANCE_LABEL = "openanalytics.eu/sp-instance"
50-
const val PROXIED_APP = "openanalytics.eu/sp-proxied-app"
49+
const val PROXIED_APP = "openanalytics.eu/sp-proxied-app"
5150
const val INGRESS_IS_LATEST = "openanalytics.eu/ingress-is-latest"
5251

53-
}
52+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/PodTemplateSpecFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import eu.openanalytics.shinyproxyoperator.Operator
2424
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2525
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2626
import io.fabric8.kubernetes.api.model.*
27-
import java.nio.file.Paths
2827

2928
class PodTemplateSpecFactory {
3029

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/PodTemplateSpecPatcher.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ import com.fasterxml.jackson.datatype.jsr353.JSR353Module
2626
import io.fabric8.kubernetes.api.model.HTTPGetAction
2727
import io.fabric8.kubernetes.api.model.IntOrString
2828
import io.fabric8.kubernetes.api.model.PodTemplateSpec
29-
import io.fabric8.kubernetes.client.internal.SerializationUtils
3029
import mu.KotlinLogging
3130
import javax.json.JsonPatch
3231
import javax.json.JsonStructure
3332

3433
class PodTemplateSpecPatcher {
3534
private val mapper = ObjectMapper(YAMLFactory())
36-
private val logger = KotlinLogging.logger { }
35+
private val logger = KotlinLogging.logger { }
3736

3837
init {
3938
mapper.registerModule(JSR353Module())

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ResourceNameFactory.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ package eu.openanalytics.shinyproxyoperator.components
2323
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2424
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2525
import mu.KotlinLogging
26-
import java.lang.IllegalStateException
2726

2827
object ResourceNameFactory {
2928

@@ -51,4 +50,4 @@ object ResourceNameFactory {
5150
return "sp-${shinyProxy.metadata.name}-ing-${shinyProxyInstance.hashOfSpec}".take(KUBE_RESOURCE_NAME_MAX_LENGTH)
5251
}
5352

54-
}
53+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/controller/IReconcileListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ package eu.openanalytics.shinyproxyoperator.controller
2323
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2424
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2525

26-
interface IReconcileListener {
26+
interface IReconcileListener {
2727

2828
fun onInstanceFullyReconciled(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance)
2929

src/main/kotlin/eu/openanalytics/shinyproxyoperator/controller/PodRetriever.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2525
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2626
import io.fabric8.kubernetes.api.model.Pod
2727
import io.fabric8.kubernetes.api.model.PodList
28-
import io.fabric8.kubernetes.client.DefaultKubernetesClient
2928
import io.fabric8.kubernetes.client.NamespacedKubernetesClient
3029
import io.fabric8.kubernetes.client.dsl.base.OperationContext
3130
import io.fabric8.kubernetes.client.informers.SharedIndexInformer
@@ -54,8 +53,8 @@ class PodRetriever(private val client: NamespacedKubernetesClient) {
5453
fun getPodsForShinyProxyInstance(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance): List<Pod> {
5554
val pods = arrayListOf<Pod>()
5655
val labels = mapOf(
57-
LabelFactory.PROXIED_APP to "true",
58-
LabelFactory.INSTANCE_LABEL to shinyProxyInstance.hashOfSpec
56+
LabelFactory.PROXIED_APP to "true",
57+
LabelFactory.INSTANCE_LABEL to shinyProxyInstance.hashOfSpec
5958
)
6059

6160
val namespacesToCheck = if (shinyProxyInstance.isLatestInstance) {
@@ -95,4 +94,4 @@ class PodRetriever(private val client: NamespacedKubernetesClient) {
9594
return informers.keys
9695
}
9796

98-
}
97+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/controller/ResourceListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ class ResourceListener<T : HasMetadata>(private val channel: SendChannel<ShinyPr
9090
return null
9191
}
9292

93-
}
93+
}

0 commit comments

Comments
 (0)