Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d954e7

Browse files
committed
Run ktlint
1 parent388d47e commit0d954e7

29 files changed

+367
-485
lines changed

‎src/main/kotlin/com/coder/gateway/CoderGatewayConnectionProvider.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
2929
returnnull
3030
}
3131

32-
overridefunisApplicable(parameters:Map<String,String>):Boolean {
33-
return parameters.isCoder()
34-
}
32+
overridefunisApplicable(parameters:Map<String,String>):Boolean= parameters.isCoder()
3533

3634
companionobject {
3735
val logger=Logger.getInstance(CoderGatewayConnectionProvider::class.java.simpleName)

‎src/main/kotlin/com/coder/gateway/CoderGatewayMainView.kt‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,19 @@ class CoderGatewayMainView : GatewayConnector {
1919
overrideval icon:Icon
2020
get()=CoderIcons.LOGO
2121

22-
overridefuncreateView(lifetime:Lifetime):GatewayConnectorView {
23-
returnCoderGatewayConnectorWizardWrapperView()
24-
}
22+
overridefuncreateView(lifetime:Lifetime):GatewayConnectorView=CoderGatewayConnectorWizardWrapperView()
2523

26-
overridefungetActionText():String {
27-
returnCoderGatewayBundle.message("gateway.connector.action.text")
28-
}
24+
overridefungetActionText():String=CoderGatewayBundle.message("gateway.connector.action.text")
2925

30-
overridefungetDescription():String {
31-
returnCoderGatewayBundle.message("gateway.connector.description")
32-
}
26+
overridefungetDescription():String=CoderGatewayBundle.message("gateway.connector.description")
3327

34-
overridefungetDocumentationAction():GatewayConnectorDocumentation {
35-
returnGatewayConnectorDocumentation(true) {
36-
HelpManager.getInstance().invokeHelp(ABOUT_HELP_TOPIC)
37-
}
28+
overridefungetDocumentationAction():GatewayConnectorDocumentation=GatewayConnectorDocumentation(true) {
29+
HelpManager.getInstance().invokeHelp(ABOUT_HELP_TOPIC)
3830
}
3931

40-
overridefungetRecentConnections(setContentCallback: (Component)->Unit):GatewayRecentConnections {
41-
returnCoderGatewayRecentWorkspaceConnectionsView(setContentCallback)
42-
}
32+
overridefungetRecentConnections(setContentCallback: (Component)->Unit):GatewayRecentConnections=CoderGatewayRecentWorkspaceConnectionsView(setContentCallback)
4333

44-
overridefungetTitle():String {
45-
returnCoderGatewayBundle.message("gateway.connector.title")
46-
}
34+
overridefungetTitle():String=CoderGatewayBundle.message("gateway.connector.title")
4735

48-
overridefunisAvailable():Boolean {
49-
returntrue
50-
}
36+
overridefunisAvailable():Boolean=true
5137
}

‎src/main/kotlin/com/coder/gateway/CoderRemoteConnectionHandle.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ class CoderRemoteConnectionHandle {
7777
)
7878
},
7979
retryIf= {
80-
itisConnectionException|| itisTimeoutException||
81-
itisSSHException|| itisDeployException
80+
itisConnectionException||
81+
itisTimeoutException||
82+
itisSSHException||
83+
itisDeployException
8284
},
8385
onException= { attempt, nextMs, e->
8486
logger.error("Failed to connect (attempt$attempt; will retry in$nextMs ms)")

‎src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt‎

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,13 @@ class CoderCLIManager(
189189
/**
190190
* Return the entity tag for the binary on disk, if any.
191191
*/
192-
privatefungetBinaryETag():String? {
193-
returntry {
194-
sha1(FileInputStream(localBinaryPath.toFile()))
195-
}catch (e:FileNotFoundException) {
196-
null
197-
}catch (e:Exception) {
198-
logger.warn("Unable to calculate hash for$localBinaryPath", e)
199-
null
200-
}
192+
privatefungetBinaryETag():String?=try {
193+
sha1(FileInputStream(localBinaryPath.toFile()))
194+
}catch (e:FileNotFoundException) {
195+
null
196+
}catch (e:Exception) {
197+
logger.warn("Unable to calculate hash for$localBinaryPath", e)
198+
null
201199
}
202200

203201
/**
@@ -230,12 +228,10 @@ class CoderCLIManager(
230228
/**
231229
* Return the contents of the SSH config or null if it does not exist.
232230
*/
233-
privatefunreadSSHConfig():String? {
234-
returntry {
235-
settings.sshConfigPath.toFile().readText()
236-
}catch (e:FileNotFoundException) {
237-
null
238-
}
231+
privatefunreadSSHConfig():String?=try {
232+
settings.sshConfigPath.toFile().readText()
233+
}catch (e:FileNotFoundException) {
234+
null
239235
}
240236

241237
/**
@@ -301,7 +297,7 @@ class CoderCLIManager(
301297
LogLevel ERROR
302298
SetEnv CODER_SSH_SESSION_TYPE=JetBrains
303299
""".trimIndent()
304-
.plus(extraConfig)
300+
.plus(extraConfig),
305301
).replace("\n",System.lineSeparator())
306302
},
307303
)
@@ -398,23 +394,21 @@ class CoderCLIManager(
398394
/**
399395
* Like version(), but logs errors instead of throwing them.
400396
*/
401-
privatefuntryVersion():SemVer? {
402-
returntry {
403-
version()
404-
}catch (e:Exception) {
405-
when (e) {
406-
isInvalidVersionException-> {
407-
logger.info("Got invalid version from$localBinaryPath:${e.message}")
408-
}
409-
else-> {
410-
// An error here most likely means the CLI does not exist or
411-
// it executed successfully but output no version which
412-
// suggests it is not the right binary.
413-
logger.info("Unable to determine$localBinaryPath version:${e.message}")
414-
}
397+
privatefuntryVersion():SemVer?=try {
398+
version()
399+
}catch (e:Exception) {
400+
when (e) {
401+
isInvalidVersionException-> {
402+
logger.info("Got invalid version from$localBinaryPath:${e.message}")
403+
}
404+
else-> {
405+
// An error here most likely means the CLI does not exist or
406+
// it executed successfully but output no version which
407+
// suggests it is not the right binary.
408+
logger.info("Unable to determine$localBinaryPath version:${e.message}")
415409
}
416-
null
417410
}
411+
null
418412
}
419413

420414
/**
@@ -475,23 +469,17 @@ class CoderCLIManager(
475469
fungetHostName(
476470
url:URL,
477471
workspaceName:String,
478-
):String {
479-
return"coder-jetbrains--$workspaceName--${url.safeHost()}"
480-
}
472+
):String="coder-jetbrains--$workspaceName--${url.safeHost()}"
481473

482474
@JvmStatic
483475
fungetBackgroundHostName(
484476
url:URL,
485477
workspaceName:String,
486-
):String {
487-
return getHostName(url, workspaceName)+"--bg"
488-
}
478+
):String= getHostName(url, workspaceName)+"--bg"
489479

490480
@JvmStatic
491481
fungetBackgroundHostName(
492482
hostname:String,
493-
):String {
494-
return hostname+"--bg"
495-
}
483+
):String= hostname+"--bg"
496484
}
497485
}

‎src/main/kotlin/com/coder/gateway/help/CoderWebHelp.kt‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ import com.intellij.openapi.help.WebHelpProvider
55
constvalABOUT_HELP_TOPIC="com.coder.gateway.about"
66

77
classCoderWebHelp :WebHelpProvider() {
8-
overridefungetHelpPageUrl(helpTopicId:String):String {
9-
returnwhen (helpTopicId) {
10-
ABOUT_HELP_TOPIC->"https://coder.com/docs/coder-oss/latest"
11-
else->"https://coder.com/docs/coder-oss/latest"
12-
}
8+
overridefungetHelpPageUrl(helpTopicId:String):String=when (helpTopicId) {
9+
ABOUT_HELP_TOPIC->"https://coder.com/docs/coder-oss/latest"
10+
else->"https://coder.com/docs/coder-oss/latest"
1311
}
1412
}

‎src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ fun toRetinaAwareIcon(image: BufferedImage): Icon {
150150
privateval isJreHiDPI:Boolean
151151
get()=JreHiDpiUtil.isJreHiDPI(sysScale)
152152

153-
overridefuntoString():String {
154-
return"TemplateIconDownloader.toRetinaAwareIcon for$image"
155-
}
153+
overridefuntoString():String="TemplateIconDownloader.toRetinaAwareIcon for$image"
156154
}
157155
}

‎src/main/kotlin/com/coder/gateway/models/RecentWorkspaceConnection.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class RecentWorkspaceConnection(
2222
configDirectory:String? =null,
2323
name:String? =null,
2424
deploymentURL:String? =null,
25-
) : BaseState(), Comparable<RecentWorkspaceConnection> {
25+
) : BaseState(),
26+
Comparable<RecentWorkspaceConnection> {
2627
@get:Attribute
2728
var coderWorkspaceHostname by string()
2829

‎src/main/kotlin/com/coder/gateway/models/WorkspaceProjectIDE.kt‎

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@ class WorkspaceProjectIDE(
4848
/**
4949
* Convert parameters into a recent workspace connection (for storage).
5050
*/
51-
funtoRecentWorkspaceConnection():RecentWorkspaceConnection {
52-
returnRecentWorkspaceConnection(
53-
name= name,
54-
coderWorkspaceHostname= hostname,
55-
projectPath= projectPath,
56-
ideProductCode= ideProduct.productCode,
57-
ideBuildNumber= ideBuildNumber,
58-
downloadSource= downloadSource,
59-
idePathOnHost= idePathOnHost,
60-
deploymentURL= deploymentURL.toString(),
61-
lastOpened= lastOpened,
62-
)
63-
}
51+
funtoRecentWorkspaceConnection():RecentWorkspaceConnection=RecentWorkspaceConnection(
52+
name= name,
53+
coderWorkspaceHostname= hostname,
54+
projectPath= projectPath,
55+
ideProductCode= ideProduct.productCode,
56+
ideBuildNumber= ideBuildNumber,
57+
downloadSource= downloadSource,
58+
idePathOnHost= idePathOnHost,
59+
deploymentURL= deploymentURL.toString(),
60+
lastOpened= lastOpened,
61+
)
6462

6563
companionobject {
6664
val logger=Logger.getInstance(WorkspaceProjectIDE::class.java.simpleName)
@@ -167,19 +165,17 @@ fun IdeWithStatus.withWorkspaceProject(
167165
hostname:String,
168166
projectPath:String,
169167
deploymentURL:URL,
170-
):WorkspaceProjectIDE {
171-
returnWorkspaceProjectIDE(
172-
name= name,
173-
hostname= hostname,
174-
projectPath= projectPath,
175-
ideProduct=this.product,
176-
ideBuildNumber=this.buildNumber,
177-
downloadSource=this.download?.link,
178-
idePathOnHost=this.pathOnHost,
179-
deploymentURL= deploymentURL,
180-
lastOpened=null,
181-
)
182-
}
168+
):WorkspaceProjectIDE=WorkspaceProjectIDE(
169+
name= name,
170+
hostname= hostname,
171+
projectPath= projectPath,
172+
ideProduct=this.product,
173+
ideBuildNumber=this.buildNumber,
174+
downloadSource=this.download?.link,
175+
idePathOnHost=this.pathOnHost,
176+
deploymentURL= deploymentURL,
177+
lastOpened=null,
178+
)
183179

184180
val remotePathRe=Regex("^[^(]+\\((.+)\\)$")
185181

‎src/main/kotlin/com/coder/gateway/sdk/convertors/InstantConverter.kt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class InstantConverter {
1313
@ToJsonfuntoJson(src:Instant?):String=FORMATTER.format(src)
1414

1515
@FromJsonfunfromJson(src:String):Instant?=
16-
FORMATTER.parse(src) {
17-
temporal:TemporalAccessor?->
16+
FORMATTER.parse(src) { temporal:TemporalAccessor?->
1817
Instant.from(temporal)
1918
}
2019

‎src/main/kotlin/com/coder/gateway/sdk/v2/models/Workspace.kt‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ data class Workspace(
2525
* Return a list of agents combined with this workspace to display in the list.
2626
* If the workspace has no agents, return just itself with a null agent.
2727
*/
28-
fun Workspace.toAgentList(resources:List<WorkspaceResource> = this.latestBuild.resources):List<WorkspaceAgentListModel> {
29-
return resources.filter { it.agents!=null }.flatMap { it.agents!! }.map { agent->
30-
WorkspaceAgentListModel(this, agent)
31-
}.ifEmpty {
32-
listOf(WorkspaceAgentListModel(this))
33-
}
28+
fun Workspace.toAgentList(resources:List<WorkspaceResource> = this.latestBuild.resources):List<WorkspaceAgentListModel>= resources.filter { it.agents!=null }.flatMap { it.agents!! }.map { agent->
29+
WorkspaceAgentListModel(this, agent)
30+
}.ifEmpty {
31+
listOf(WorkspaceAgentListModel(this))
3432
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp