Devops: KTLint to lint Kotlin code (#6)

* Adds KTLint as a GitHub action
* Adds KTLint to the gradle project for IDE integration
* Adds .editorconfig to configure KTLint (android/)
This commit is contained in:
Marc Rousavy
2021-02-26 10:56:20 +01:00
committed by GitHub
parent 2e60110070
commit 03b9246afe
31 changed files with 1233 additions and 1190 deletions

View File

@@ -6,10 +6,10 @@ import android.hardware.camera2.CameraCharacteristics
* Parses Lens Facing int to a string representation useable for the TypeScript types.
*/
fun parseLensFacing(lensFacing: Int?): String? {
return when (lensFacing) {
CameraCharacteristics.LENS_FACING_BACK -> "back"
CameraCharacteristics.LENS_FACING_FRONT -> "front"
CameraCharacteristics.LENS_FACING_EXTERNAL -> "external"
else -> null
}
return when (lensFacing) {
CameraCharacteristics.LENS_FACING_BACK -> "back"
CameraCharacteristics.LENS_FACING_FRONT -> "front"
CameraCharacteristics.LENS_FACING_EXTERNAL -> "external"
else -> null
}
}

View File

@@ -6,15 +6,15 @@ import kotlin.math.max
import kotlin.math.min
val Size.bigger: Int
get() = max(this.width, this.height)
get() = max(this.width, this.height)
val Size.smaller: Int
get() = min(this.width, this.height)
get() = min(this.width, this.height)
val SizeF.bigger: Float
get() = max(this.width, this.height)
get() = max(this.width, this.height)
val SizeF.smaller: Float
get() = min(this.width, this.height)
get() = min(this.width, this.height)
fun areUltimatelyEqual(size1: Size, size2: Size): Boolean {
return size1.width * size1.height == size2.width * size2.height
return size1.width * size1.height == size2.width * size2.height
}