KontureScope

class KontureScope(val classes: List<ClassDeclaration>)

Represents a scope containing a set of classes for writing architecture rules in a Konsist-inspired fluent DSL.

A scope acts as the starting point or container for filtering, querying, and running assertions against Kotlin class declarations in your codebase.

Constructors

Link copied to clipboard
constructor(classes: List<ClassDeclaration>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The list of ClassDeclaration structures included in this scope.

Functions

Link copied to clipboard

Asserts that all class declarations in the scope represent abstract classes or interfaces.

Link copied to clipboard
fun KontureScope.assertAreAssignableTo(vararg superTypes: String)

Asserts that all class declarations in the scope extend or implement any of the specified supertypes.

Link copied to clipboard

Asserts that all class declarations in the scope are data classes.

Link copied to clipboard

Asserts that all class declarations in the scope represent enum classes.

Link copied to clipboard

Asserts that all class declarations in the scope are inline/value classes.

Link copied to clipboard

Asserts that all class declarations in the scope represent interfaces.

Link copied to clipboard

Asserts that all class declarations in the scope are internal.

Link copied to clipboard

Asserts that all class declarations in the scope are private.

Link copied to clipboard

Asserts that all class declarations in the scope are protected.

Link copied to clipboard

Asserts that all class declarations in the scope are public.

Link copied to clipboard

Asserts that all class declarations in the scope are sealed classes.

Link copied to clipboard
fun KontureScope.assertHasKDoc(additionalMessage: String? = null)
Link copied to clipboard
fun KontureScope.assertHaveAnnotationOf(vararg annotationFqNames: String)

Asserts that all class declarations in the scope have at least one of the specified annotations. Matches either the annotation's simple name or its fully qualified name (FQN).

Link copied to clipboard

Asserts that all class declarations in the scope have the specified visibility.

Link copied to clipboard

Asserts that all class declarations in the scope have names ending with any of the specified suffixes.

Link copied to clipboard
fun KontureScope.assertNameMatching(vararg patterns: String)

Asserts that all class declarations in the scope have names matching any of the specified glob patterns. Supports '*' wildcards.

Link copied to clipboard

Asserts that all class declarations in the scope have names starting with any of the specified prefixes.

Link copied to clipboard
fun KontureScope.assertOnlyBeAccessedByAnyPackage(vararg packagePatterns: String, allClasses: List<ClassDeclaration> = Konture.projectGraph.getAllModules().flatMap { it.classes })

Asserts that the selected classes in the scope are only accessed by classes residing in packages matching the specified patterns.

Link copied to clipboard
fun KontureScope.assertOnlyDependOnClassesInAnyPackage(vararg packagePatterns: String, allClasses: List<ClassDeclaration> = Konture.projectGraph.getAllModules().flatMap { it.classes })

Asserts that the selected classes in the scope depend only on classes residing in packages matching the specified patterns.

Link copied to clipboard
fun KontureScope.assertResideInAPackage(vararg packagePatterns: String)

Asserts that all class declarations in the scope reside in packages matching any of the specified patterns. Matches using standard Kotlin package wildcard matching (e.g. "..domain..").

Link copied to clipboard
fun KontureScope.assertTrue(additionalMessage: String? = null, predicate: (ClassDeclaration) -> Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard