Skip to content

Commit

Permalink
Merge pull request #84 from macisamuele/maci-update-lint-suppressions…
Browse files Browse the repository at this point in the history
…-and-jacoco

Update lint suppression directives and update jacoco version
  • Loading branch information
macisamuele authored Jan 27, 2020
2 parents 3e24abe + 75bcedf commit 9a23d29
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@file:Suppress("Unused")

object PublishingVersions {
const val PLUGIN_VERSION = "1.3.0"
const val PLUGIN_GROUP = "com.yelp.codegen"
@Suppress("UNUSED")
const val PLUGIN_ARTIFACT = "plugin"
}
2 changes: 1 addition & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ java {
}

jacoco {
toolVersion = "0.8.4"
toolVersion = "0.8.5"
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/main/java/com/yelp/codegen/KotlinGenerator.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("TooManyFunctions", "NOTHING_TO_INLINE")

package com.yelp.codegen

import com.google.common.annotations.VisibleForTesting
Expand All @@ -21,6 +19,7 @@ import io.swagger.models.Swagger
import io.swagger.models.properties.Property
import java.io.File

@Suppress("TooManyFunctions")
open class KotlinGenerator : SharedCodegen() {

companion object {
Expand Down Expand Up @@ -374,6 +373,7 @@ open class KotlinGenerator : SharedCodegen() {
/**
* Check if a name is of the type `com.x.name`, which means it has a fully qualified package.
*/
@Suppress("NOTHING_TO_INLINE")
private inline fun String.isFullyQualifiedImportName() = "." in this

override fun postProcessModels(objs: Map<String, Any>): Map<String, Any> {
Expand Down
3 changes: 1 addition & 2 deletions plugin/src/main/java/com/yelp/codegen/SharedCodegen.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("TooManyFunctions")

package com.yelp.codegen

import com.yelp.codegen.utils.InlineModelResolver
Expand Down Expand Up @@ -43,6 +41,7 @@ internal const val X_UNSAFE_OPERATION = "x-unsafe-operation"
internal const val HEADER_X_OPERATION_ID = "X-Operation-ID"
internal const val HEADER_CONTENT_TYPE = "Content-Type"

@Suppress("TooManyFunctions")
abstract class SharedCodegen : DefaultCodegen(), CodegenConfig {

// Reference to the Swagger Specs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.gradle.api.Action
import org.gradle.api.Project
import java.io.File

open class GenerateTaskConfiguration(project: Project) {
open class GenerateTaskConfiguration(@Suppress("UNUSED_PARAMETER") project: Project) {
var platform: String? = null
var packageName: String? = null
var specName: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ class PropertyMapEndpointTest {
assertEquals("array_value1", (returned.objectMap?.get("key3") as List<*>)[0])

assertFalse((returned.objectMap?.get("key4") as Map<*, *>).isEmpty())
assertEquals("map_value1", (returned.objectMap?.get("key4") as Map<String, Any>)["map_key1"])
assertEquals(
"map_value1", (
@Suppress("UNCHECKED_CAST")
(returned.objectMap?.get("key4") as Map<String, Any>)
)["map_key1"]
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,13 @@ class XnullablePropertyMapEndpointTest {
assertEquals("array_value1", (returned.objectMap?.get("key3") as List<*>)[0])

assertFalse((returned.objectMap?.get("key4") as Map<*, *>).isEmpty())
assertEquals("map_value1", (returned.objectMap?.get("key4") as Map<String, Any>)["map_key1"])
assertEquals(
"map_value1",
(
@Suppress("UNCHECKED_CAST")
(returned.objectMap?.get("key4") as Map<String, Any>)
)["map_key1"]
)
assertNull(returned.objectMap?.get("key5"))
}
}

0 comments on commit 9a23d29

Please sign in to comment.