KatachiKonsistNoKotlinFilesException

A konsist { } constraint that covers files, none of which Konsist can parse.

Konsist 0.17.3 parses a file only when its name ends in .kt — .kts scripts included, they are not parsed. A constraint covering, say, only build.gradle.kts would therefore be handed an empty scope and pass by empty truth, which is the one answer this backend must never give silently.

A constraint covering no files at all is a different thing and is not an error: that is a place waiting to fill up, and the layout check already treats it as normal.

Example 1: catch a rule written over files Konsist cannot read

val failure = shouldThrow<KatachiArchitectureAssertionError> {
projectArchitecture.assert(FileConstraintCheck())
}
failure.violations.filterIsInstance<UncheckedFileConstraint>()
.single().cause.shouldBeInstanceOf<KatachiKonsistNoKotlinFilesException>()

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard

What the constraint was called, or null when it was declared without a name.

Link copied to clipboard

Where the constraint was written.

Link copied to clipboard
val given: Int

How many files the constraint covered, none of which Konsist parses.

Link copied to clipboard
open val message: String?
Link copied to clipboard

The qualified name of the role whose layout the constraint was written in.