# Architecture rules

<!-- Generated by architecture/…/GeneratedDocsTest.kt from the build files and the rule tests. Don't edit: -->
<!-- EPHYRA_WRITE_GENERATED=1 ./gradlew :architecture:test --rerun --tests '*GeneratedDocsTest*' -->

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](README.md#the-rules) and the ADRs.

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