From e8c73d9f6e70d881bec4a3328148f4f8c956cde7 Mon Sep 17 00:00:00 2001 From: TimPushkin Date: Tue, 27 Jun 2023 17:00:36 +0300 Subject: [PATCH] Fix codestyle issues --- README.md | 5 +++-- .../java/ru/spbu/depnav/data/db/DatabaseInserts.kt | 8 +++----- app/src/main/java/ru/spbu/depnav/ui/map/FloorSwitch.kt | 1 + app/src/main/java/ru/spbu/depnav/ui/map/MarkerView.kt | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fe67f5bf..fbb578c6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # DepNav – Department Navigator -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c24bf04feb8840ebb9a6fea2f0389020)](https://www.codacy.com/gh/TimPushkin/DepNav/dashboard?utm_source=github.com&utm_medium=referral&utm_content=TimPushkin/DepNav&utm_campaign=Badge_Grade) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bc683c7328e847a49fe41f69b21a41b1)](https://app.codacy.com/gh/TimPushkin/DepNav/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Known Vulnerabilities](https://snyk.io/test/github/TimPushkin/DepNav/badge.svg)](https://snyk.io/test/github/TimPushkin/DepNav) **DepNav** is an Android application for viewing indoor maps of departments and searching for @@ -35,6 +35,7 @@ The following download sources are available: or [AppGallery](https://appgallery.cloud.huawei.com/ag/n/app/C106717783?channelId=GitHub+repository&id=05d3f9cea9c44d829cd43b9f79593c88&s=A358D75497B3480E158A47713DE08E03B4047FD6FD5F2DA45C7AF9D9B5410F64&detailType=0&v=&callType=AGDLINK&installType=0000) (**recommended**) – install DepNav from app stores and receive its updates automatically -- [APK](https://github.com/TimPushkin/DepNav/releases) – download, install, and update DepNav manually +- [APK](https://github.com/TimPushkin/DepNav/releases) – download, install, and update DepNav + manually Android 5.0 or newer required. diff --git a/app/src/androidTest/java/ru/spbu/depnav/data/db/DatabaseInserts.kt b/app/src/androidTest/java/ru/spbu/depnav/data/db/DatabaseInserts.kt index 8936f947..76f03e90 100644 --- a/app/src/androidTest/java/ru/spbu/depnav/data/db/DatabaseInserts.kt +++ b/app/src/androidTest/java/ru/spbu/depnav/data/db/DatabaseInserts.kt @@ -18,7 +18,7 @@ @file:Suppress( "MethodOverloading", // Overloading insertAll for different tables - "TooManyFunctions" // All these function belong together + "TooManyFunctions" // All these functions belong together ) package ru.spbu.depnav.data.db @@ -37,10 +37,8 @@ private fun MarkerText.values() = listOf(markerId, languageId.name, title, descr @Suppress("ComplexMethod") // Further "simplification" is unreasonable private fun createContentValues(columnNames: Array, values: List): ContentValues { - if (columnNames.size != values.size) { - throw IllegalArgumentException( - "Expected ${columnNames.size} values, but was ${values.size}" - ) + require(columnNames.size == values.size) { + "Expected ${columnNames.size} values, but was ${values.size}" } return ContentValues().apply { for ((col, v) in columnNames.zip(values)) { diff --git a/app/src/main/java/ru/spbu/depnav/ui/map/FloorSwitch.kt b/app/src/main/java/ru/spbu/depnav/ui/map/FloorSwitch.kt index 438c407e..913b0437 100644 --- a/app/src/main/java/ru/spbu/depnav/ui/map/FloorSwitch.kt +++ b/app/src/main/java/ru/spbu/depnav/ui/map/FloorSwitch.kt @@ -98,6 +98,7 @@ fun FloorSwitch( @Preview @Composable +@Suppress("UnusedPrivateMember") private fun FloorSwitchPreview() { DepNavTheme { FloorSwitch( diff --git a/app/src/main/java/ru/spbu/depnav/ui/map/MarkerView.kt b/app/src/main/java/ru/spbu/depnav/ui/map/MarkerView.kt index 8f59b305..e2731090 100644 --- a/app/src/main/java/ru/spbu/depnav/ui/map/MarkerView.kt +++ b/app/src/main/java/ru/spbu/depnav/ui/map/MarkerView.kt @@ -151,6 +151,7 @@ private fun RoomName(name: String, lineTrough: Boolean, modifier: Modifier = Mod @Preview @Composable +@Suppress("UnusedPrivateMember") private fun MarkerIconPreview() { DepNavTheme { MarkerView( @@ -163,6 +164,7 @@ private fun MarkerIconPreview() { @Preview @Composable +@Suppress("UnusedPrivateMember") private fun MarkerIconClosedPreview() { DepNavTheme { MarkerView( @@ -175,6 +177,7 @@ private fun MarkerIconClosedPreview() { @Preview @Composable +@Suppress("UnusedPrivateMember") private fun RoomIconPreview() { DepNavTheme(darkTheme = false) { MarkerView( @@ -187,6 +190,7 @@ private fun RoomIconPreview() { @Preview @Composable +@Suppress("UnusedPrivateMember") private fun RoomIconClosedPreview() { DepNavTheme { MarkerView(