FilesRuleBuilder

class FilesRuleBuilder(graph: ProjectGraph = Konture.projectGraph)

A builder for compiling and verifying architectural rules on Kotlin source files.

Accumulates filtering conditions (that()) and assertions (should()), which are verified against all source files in the project.

Constructors

Link copied to clipboard
constructor(graph: ProjectGraph = Konture.projectGraph)

Functions

Link copied to clipboard

Configures this builder to allow empty selections (i.e. if no files match the that() filter, the rule will pass instead of throwing an AssertionError).

Link copied to clipboard
fun and(): FilesThat

Logical AND operator for chaining filter conditions.

Link copied to clipboard

Logical AND operator for chaining assertion rules.

Link copied to clipboard
fun check(g: ProjectGraph = graph)

Executes the compiled file rules against the provided project graph. Throws an AssertionError if any rule violations are detected.

Link copied to clipboard
fun not(): FilesThat

Negates the next filter condition in the chain.

Link copied to clipboard

Negates the next assertion rule in the chain.

Link copied to clipboard
fun or(): FilesThat

Logical OR operator for chaining filter conditions.

Link copied to clipboard

Logical OR operator for chaining assertion rules.

Link copied to clipboard

Starts adding assertion rules that the selected files must satisfy.

Link copied to clipboard

Asserts rules on filtered files using a lambda block that provides a FileDeclarationShouldContext receiver. Supports both imperative assertions and Boolean predicate matches.

Link copied to clipboard

Starts adding filtering conditions to select which files to verify.

Link copied to clipboard

Filters files in this rule using a concise lambda predicate evaluated on each FileDeclarationContext.

Link copied to clipboard
fun xor(): FilesThat

Logical XOR operator for chaining filter conditions.

Link copied to clipboard

Logical XOR operator for chaining assertion rules.