Skip to content

Commit

Permalink
chore: address all warnings (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbotsf authored Aug 3, 2021
1 parent bd016ae commit a6602fa
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 6 deletions.
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ allprojects {
}
}

if (project.properties["kotlinWarningsAsErrors"]?.toString()?.toBoolean() == true) {
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
}
}
}

apply(from = rootProject.file("gradle/codecoverage.gradle"))

val ktlint by configurations.creating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ internal class Waiter {
suspend fun wait() { channel.receive() }

// give the signal to continue
fun signal() { channel.offer(Unit) }
fun signal() { channel.trySend(Unit).getOrThrow() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ internal fun HttpRequest.toKtorRequestBuilder(): KtorHttpRequestBuilder {
val sdkUrl = this.url
val sdkHeaders = this.headers
builder.url {
protocol = URLProtocol(sdkUrl.scheme.protocolName.toLowerCase(), sdkUrl.scheme.defaultPort)
val protocolName = sdkUrl.scheme.protocolName.replaceFirstChar(Char::lowercaseChar)
protocol = URLProtocol(protocolName, sdkUrl.scheme.defaultPort)
host = sdkUrl.host
port = sdkUrl.port
encodedPath = sdkUrl.path.encodeURLPath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ class JsonDeserializerTest {
else -> throw RuntimeException("unexpected field during test")
}
}
nested
}
return nested
}
Expand Down
10 changes: 10 additions & 0 deletions runtime/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@
*/

description = "Internal test utilities"

kotlin {
sourceSets {
metadata {
dependencies {
commonMainApi(project(":runtime:utils"))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ abstract class HttpBindingProtocolGenerator : ProtocolGenerator {
// be different though (e.g. uri/method). We need to generate a serializer/deserializer per/operation
// NOT per input/output shape
val deserializerSymbol = buildSymbol {
definitionFile = "${op.deserializerName().capitalize()}.kt"
val definitionFileName = op.deserializerName().replaceFirstChar(Char::uppercaseChar)
definitionFile = "$definitionFileName.kt"
name = op.deserializerName()
namespace = "${ctx.settings.pkg.name}.transform"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ open class DeserializeStructGenerator(
}

// TODO ~ Not yet implemented
@Suppress("UNUSED_PARAMETER") // Until method is implemented
protected fun renderDocumentShapeDeserializer(memberShape: MemberShape) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ open class FormUrlSerdeDescriptorGenerator(
traits.add(SerdeFormUrl.FormUrlMapName, *it.toTypedArray())
}
}
else -> { } // No action needed
}

return traits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ open class SerializeStructGenerator(
}
}

@Suppress("UNUSED_PARAMETER") // Until method is implemented
private fun renderDocumentShapeSerializer(memberShape: MemberShape) {
// TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ open class XmlSerdeDescriptorGenerator(
traitList.add(it)
}
}
else -> { } // No action needed
}

return traitList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fun String.toCamelCase(): String = toPascalCase().replaceFirstChar { c -> c.lowe
* * 'A' → 'a'
* * '!' → '!'
*/
fun Char.toggleCase(): Char = if (isUpperCase()) toLowerCase() else toUpperCase()
fun Char.toggleCase(): Char = if (isUpperCase()) lowercaseChar() else uppercaseChar()

/**
* Toggles the case of the first character in the string. For example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class KotlinWriterTest {
writer.write(previousValue)
}

unit.registerSectionWriter(NestedTestId) { writer, previousValue ->
unit.registerSectionWriter(NestedTestId) { writer, _ ->
val state = writer.getContext(NestedTestId.a)
writer.write("// nested section with state $state")
}
Expand Down

0 comments on commit a6602fa

Please sign in to comment.