79156022

Date: 2024-11-04 15:24:27
Score: 0.5
Natty:
Report link

Asking ChatGPT proves to be a valid way to get ideas:

class EnforceDateTimeProviderUsageTest : FunSpec({

val scope = Konsist
    .scopeFromProduction()
    .files
    .filter { it.name != "DateTimeProvider" }

  listOf(
    "LocalDate.now()", 
    "LocalDateTime.now()", 
    "Instant.now()"
  ).forEach { forbiddenCall ->
      scope.filter { it.text.contains(forbiddenCall) }.shouldBeEmpty()
  } 
})
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Martin