kamiazya/scopes

Enhance Konsist rules for broader test framework support

オープン

#127 opened on 2025/08/31

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Kotlin (3 件のフォーク)auto 404
enhancementgood first issuehacktoberfest

Repository metrics

Stars
 (2 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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)

コントリビューターガイド