mustBeEmpty
Rejects every element of this list, so that a query which finds anything at all fails.
This is how "there must be none of these" is written: narrow with Konsist's query vocabulary until the list holds exactly what is forbidden, then say so.
Example 1: no public class is left in an internal layer
"is not usable from outside".konsist {
classes().filter { it.hasPublicOrDefaultModifier }.mustBeEmpty()
}Content copied to clipboard