kamiazya/scopes

Enhance Konsist rules for broader test framework support

Open

#127 opened on Aug 31, 2025

 (0 comments) (0 reactions) (0 assignees)Kotlin (3 forks)auto 404
enhancementgood first issuehacktoberfest

Repository metrics

Stars
 (2 stars)
PR merge metrics
 (PR metrics pending)

Description

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