Skip to content

Architecture rules

The Konsist rules in architecture/, read from the names of their tests. Run them with ./gradlew :architecture:test (also part of testDebugUnitTest). When one fails, fix the code: the files in architecture/baseline/ are allowlists, not debt. A rule says what each of its tests checks; the tests of the scanner itself (finds …, counts …, skips …) are left out. Why each rule exists is in README.md and the ADRs.

Rule Says Tests
R1 no production file outside the adapter mentions the SDK SdkBoundaryTest.kt
R2 no production file outside the adapter imports JellyfinApi SdkBoundaryTest.kt
R3 only the Jellyfin adapter module declares the SDK dependency SdkBoundaryTest.kt
R4 no production file outside data imports ServerDatabaseDao SdkBoundaryTest.kt
R5 the domain module imports nothing from Android, the SDK, Room or the SDK wrapper
the application module imports nothing from Android, the SDK, Room or data
DomainPurityTest.kt
R6 the engine packages use neither each other nor are used by shared code PlayerEngineBoundaryTest.kt
R7 only the apps depend on the Jellyfin adapter module SdkBoundaryTest.kt
R8 the testing module is only a test dependency TestingModuleTest.kt
R9 only the apps depend on data
only the apps depend on the MDBList adapter
only the apps depend on the device adapter
DataDependencyTest.kt
R10 no production signature outside the adapter types a server or source id as String
no production file outside the adapter imports or names java util UUID
StringIdsTest.kt, UuidBoundaryTest.kt
R11 no production type is named Findroid, and none is named Jellyfin outside the adapter NamesTest.kt
R12 only Ticks declares tick constants and converts a ticks value by a tick literal TicksConversionTest.kt
R13 only DownloadState names the partial download suffix DownloadSuffixTest.kt
R14 the play state rules are declared in domain alone, and data and the sync compare no dates PlayStateRulesTest.kt
R15 downloads depends on no adapter, not on core and not on an app
no file outside downloads names the engine’s implementation
DownloadsModuleTest.kt
R16 the server in use is written as one value, in one place ActiveServerTest.kt
R17 no production file of data, server jellyfin, ratings mdblist, device or downloads names AppPreferences AdapterSettingsTest.kt
R18 no adapter module depends on a feature module AdapterDependencyTest.kt
R19 domain and application import only Kotlin, kotlinx, the JDK and their own code
domain and application declare no library but kotlinx
PureKotlinTest.kt
R20 data imports nothing of Android but Room, SQLite and Context RoomAdapterTest.kt
R21 no port declares more than fifteen functions and properties PortSizeTest.kt
R22 no adapter file names a port of another adapter AdapterPortsTest.kt
R23 no view model outside settings takes AppPreferences or a Context ViewModelSettingsTest.kt
R24 the largest files of playback and downloads stay under their line ceilings SizeCeilingTest.kt
R25 only the reports service calls the report operations, and only the repository the port’s ReportSenderTest.kt
R26 domain names no dispatcher and no clock, application only as a constructor default HiddenTimeTest.kt
R27 no file of the local player outside engine, mapping, presentation and di names media3 PlayerRulesMedia3Test.kt
R28 no production file outside device and the apps asks Android about networks or permissions DeviceAdapterTest.kt

Source: docs/architecture/rules.md · raw Markdown