kamiazya/scopes

Enhance Konsist rules for broader test framework support

Offen

#127 geöffnet am 31.08.2025

 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Kotlin (3 Forks)auto 404
enhancementgood first issuehacktoberfest

Repository-Metriken

Stars
 (2 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Background

CodeRabbit review of PR #119 suggested several enhancements to our Konsist architecture validation rules to make them more comprehensive and reduce false positives.

Suggested Improvements

DatabaseTestingRulesTest.kt

  1. Broaden lifecycle hooks detection

    • Support Kotest beforeSpec/afterSpec and JUnit @BeforeAll/@AfterAll
    • Recognize use {} and try/finally patterns for resource closing
  2. Include other SqlDelight drivers

    • Support NativeSqliteDriver and AndroidSqliteDriver
    • Improve in-memory database detection patterns
  3. Better property state detection

    • Use anchored regex for var/val detection
    • Avoid false positives from comments

EventSourcingArchitectureTest.kt

  1. Detect injected clocks

    • Support clock.now() pattern for dependency-injected clocks
    • Not just Clock.System.now()
  2. Allow negative test cases

    • Permit future timestamps when test explicitly asserts failure
    • Detect shouldThrow, shouldBeLeft, etc.
  3. Support virtual time testing

    • Recognize TestClock, FixedClock usage
    • Support coroutine test utilities

General Improvements

  • File-level enforcement instead of per-class for some rules
  • Consider DB-level constraints as valid validation strategy
  • Narrow scope to domain packages to avoid framework classes

Priority

Low - Current rules work well, these are enhancements for edge cases

Related

  • PR #119 (initial Konsist rules implementation)
  • Issue #125 (runTest migration)

Contributor Guide