Formatting.

Disable line length check in detekt. It's being guarded by KtLint already.
This commit is contained in:
tzugen 2022-07-05 15:30:41 +02:00
parent ad54db5bcb
commit 53a1a5545a
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
9 changed files with 14 additions and 17 deletions

View File

@ -9,7 +9,6 @@ package org.moire.ultrasonic.domain
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.util.Date
@Entity(tableName = "albums", primaryKeys = ["id", "serverId"])

View File

@ -9,7 +9,6 @@ package org.moire.ultrasonic.domain
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "artists", primaryKeys = ["id", "serverId"])
data class Artist(

View File

@ -9,6 +9,7 @@ package org.moire.ultrasonic.domain
import androidx.room.Ignore
@Suppress("LongParameterList")
abstract class ArtistOrIndex(
@Ignore
override var id: String,

View File

@ -9,7 +9,6 @@ package org.moire.ultrasonic.domain
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "indexes", primaryKeys = ["id", "serverId"])
data class Index(

View File

@ -9,7 +9,6 @@ package org.moire.ultrasonic.domain
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.io.Serializable
import java.util.Date

View File

@ -64,10 +64,7 @@ style:
WildcardImport:
active: true
MaxLineLength:
active: true
maxLineLength: 120
excludePackageStatements: false
excludeImportStatements: false
active: false
MagicNumber:
# 100 common in percentage, 1000 in milliseconds
ignoreNumbers: ['-1', '0', '1', '2', '5', '10', '100', '256', '512', '1000', '1024', '4096']

View File

@ -14,12 +14,12 @@ import androidx.room.TypeConverter
import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import java.util.Date
import org.moire.ultrasonic.domain.Album
import org.moire.ultrasonic.domain.Artist
import org.moire.ultrasonic.domain.Index
import org.moire.ultrasonic.domain.MusicFolder
import org.moire.ultrasonic.domain.Track
import java.util.Date
/**
* This database is used to store and cache the ID3 metadata
@ -67,7 +67,8 @@ class Converters {
}
}
val META_MIGRATION_2_3: Migration = object : Migration(2,3) {
/* ktlint-disable max-line-length */
val META_MIGRATION_2_3: Migration = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("DROP TABLE `albums`")
database.execSQL("DROP TABLE `indexes`")
@ -81,3 +82,4 @@ val META_MIGRATION_2_3: Migration = object : Migration(2,3) {
database.execSQL("CREATE TABLE IF NOT EXISTS `tracks` (`id` TEXT NOT NULL, `serverId` INTEGER NOT NULL DEFAULT -1, `parent` TEXT, `isDirectory` INTEGER NOT NULL, `title` TEXT, `album` TEXT, `albumId` TEXT, `artist` TEXT, `artistId` TEXT, `track` INTEGER, `year` INTEGER, `genre` TEXT, `contentType` TEXT, `suffix` TEXT, `transcodedContentType` TEXT, `transcodedSuffix` TEXT, `coverArt` TEXT, `size` INTEGER, `songCount` INTEGER, `duration` INTEGER, `bitRate` INTEGER, `path` TEXT, `isVideo` INTEGER NOT NULL, `starred` INTEGER NOT NULL, `discNumber` INTEGER, `type` TEXT, `created` INTEGER, `closeness` INTEGER NOT NULL, `bookmarkPosition` INTEGER NOT NULL, `userRating` INTEGER, `averageRating` REAL, `name` TEXT, PRIMARY KEY(`id`, `serverId`))")
}
}
/* ktlint-enable max-line-length */

View File

@ -21,11 +21,13 @@ internal val playlistDateFormat by lazy(NONE) { SimpleDateFormat.getInstance() }
fun APIPlaylist.toMusicDirectoryDomainEntity(serverId: Int): MusicDirectory =
MusicDirectory().apply {
name = this@toMusicDirectoryDomainEntity.name
addAll(this@toMusicDirectoryDomainEntity.entriesList.map {
val item = it.toTrackEntity(serverId)
item.serverId = serverId
item
})
addAll(
this@toMusicDirectoryDomainEntity.entriesList.map {
val item = it.toTrackEntity(serverId)
item.serverId = serverId
item
}
)
}
fun APIPlaylist.toDomainEntity(): Playlist = Playlist(

View File

@ -7,7 +7,6 @@ import org.amshove.kluent.`should be equal to`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild
import org.moire.ultrasonic.api.subsonic.models.Playlist
import org.moire.ultrasonic.data.ActiveServerProvider
/**
* Unit test for extension functions that converts api playlist entity to domain.
@ -23,7 +22,7 @@ class APIPlaylistConverterTest : BaseTest() {
)
)
val convertedEntity = entity.toMusicDirectoryDomainEntity(ActiveServerProvider.getActiveServerId())
val convertedEntity = entity.toMusicDirectoryDomainEntity(serverId)
with(convertedEntity) {
name `should be equal to` entity.name