Konture

object Konture

Main entry point for Konture. All architecture assertion builders, scoping builders, and graph configurations are extended from or accessible through this object.

Properties

Link copied to clipboard

The file path of the baseline file relative to the baseline directory. Default value is obtained from system property "konture.baseline.path" or falls back to "konture-baseline.json". Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

The base directory of the persistent analysis cache. Defaults to ".konture/cache" resolved against the current working directory. Can be configured via system property "konture.cache.dir" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Whether persistent disk caching of analysis results is enabled. When enabled (requires incremental too), parsed AST snapshots are written to cacheDir and reused across JVM runs, so unchanged Kotlin files skip re-parsing entirely in later test executions. Can be configured via system property "konture.cache.enabled" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Optional fingerprint used to namespace the persistent analysis cache. Changing the fingerprint invalidates previously stored entries, which is the recommended way to invalidate the cache when rule definitions or analysis configuration change. The Gradle plugin computes this automatically from the effective konture { analysis { } } configuration. Can be configured via system property "konture.cache.fingerprint" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Synonym for scope representing class-level functional scope for the entire project.

Link copied to clipboard

Default baseline filename fallback when no custom path is configured.

Link copied to clipboard

Default persistent cache directory.

Link copied to clipboard

Default value for persistent disk caching.

Link copied to clipboard

Default value for failing on resolved baseline violations.

Link copied to clipboard

Default HTML report path.

Link copied to clipboard

Default value for incremental AST analysis.

Link copied to clipboard

Default JSON report path.

Link copied to clipboard

Default value for parallel rule evaluation.

Link copied to clipboard

Default maximum worker count for parallel evaluation (0 indicates automatic sizing based on available CPU cores).

Link copied to clipboard

Default value for reporting resolved baseline violations.

Link copied to clipboard

Default SARIF report path.

Link copied to clipboard

Whether to fail the test execution if resolved violations exist in the baseline (ratchet mode). Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard
var failOnSeverity: Severity?

The minimum severity threshold required for rule violations to trigger test failure. When null, Konture runs in audit / dry-run mode (no violations cause test failure). Can be configured via system property "konture.fail.on.severity" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Retrieves a file-level functional KontureFileScope representing all files in the project.

Link copied to clipboard

Retrieves a function-level functional KontureFunctionScope representing all functions in the project.

Link copied to clipboard

Flag indicating whether to generate violations into the baseline file rather than throwing AssertionError. Default value is obtained from system property "konture.baseline.generate" (as boolean) or falls back to false. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Target HTML report output path relative to project build directory. Default value is obtained from system property "konture.report.html.path" or falls back to "build/reports/konture/konture-report.html". Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Whether incremental AST analysis and source hashing are enabled. When enabled, unchanged Kotlin files are resolved from the AST cache without re-parsing. Can be configured via system property "konture.incremental.enabled" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Target JSON report output path relative to project build directory. Default value is obtained from system property "konture.report.json.path" or falls back to "build/reports/konture/konture-report.json". Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

The target translation locale for architectural guardrail messages. Can be configured via system property "konture.locale" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Retrieves a module-level functional KontureModuleScope representing all modules in the project.

Link copied to clipboard

The output format used when formatting architecture violation reports upon failure. Can be configured via system property "konture.output.format" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Whether parallel evaluation of independent rules is enabled. When enabled, rule suites are evaluated concurrently across CPU cores using coroutines. Can be configured via system property "konture.parallel.enabled" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

The maximum number of worker threads for parallel rule evaluation. Defaults to 0 (automatic sizing using available processor cores). Can be configured via system property "konture.parallel.maxWorkers" or programmatically. Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Lazily and thread-safely loads the ProjectGraph from the default resource path on first use, or retrieves the default graph if already initialized.

Link copied to clipboard

System property key used to override the target output directory for baseline files.

Link copied to clipboard

System property key used to enable/disable baseline generation mode.

Link copied to clipboard

System property key used to override the path of baseline files.

Link copied to clipboard

System property key used to override the persistent cache directory.

Link copied to clipboard

System property key used to enable/disable persistent disk caching of analysis results.

Link copied to clipboard

System property key used to override the persistent cache fingerprint.

Link copied to clipboard

System property key used to fail the build when resolved baseline violations are detected.

Link copied to clipboard

System property key used to override the minimum severity failure threshold.

Link copied to clipboard

System property key used to enable/disable incremental AST analysis and caching.

Link copied to clipboard

System property key used to override the target translation language / locale.

Link copied to clipboard

System property key used to override the output format (e.g. human, problem_matcher).

Link copied to clipboard

System property key used to enable/disable parallel rule evaluation.

Link copied to clipboard

System property key used to configure the maximum number of worker threads for parallel rule evaluation.

Link copied to clipboard

System property key used to override the path of generated HTML report files.

Link copied to clipboard

System property key used to override the path of generated JSON report files.

Link copied to clipboard

System property key used to override the path of generated HTML/JSON/SARIF report files.

Link copied to clipboard

System property key used to enable reporting of resolved baseline violations.

Link copied to clipboard

System property key used to override the path of generated SARIF report files.

Link copied to clipboard

Retrieves a property-level functional KonturePropertyScope representing all properties in the project.

Link copied to clipboard

Target report output path relative to project build directory. Default value is obtained from system property "konture.report.path" or falls back to "build/reports/konture/konture-report.html". Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Whether to log and report baseline violations that have been resolved (fixed in code). Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Target SARIF report output path relative to project build directory. Default value is obtained from system property "konture.report.sarif.path" or falls back to "build/reports/konture/konture-report.sarif". Backed by ThreadLocal state; safe under parallel test execution.

Link copied to clipboard

Retrieves a class-level functional KontureScope representing the entire project.

Functions

Link copied to clipboard

Unified multi-rule block supporting modules, classes, and layered architecture validations. Runs every declared suite and aggregates all violations before failing.

Unified multi-rule block supporting modules, classes, and layered architecture validations against a specific ProjectGraph. Runs every declared suite and aggregates all violations before failing.

Link copied to clipboard

Builder function on Konture for defining a reusable RuleSet.

fun Konture.architectureRules(name: String? = null, block: RuleSetBuilder.() -> Unit): RuleSet

Builder function on Konture for defining a reusable, named RuleSet.

Link copied to clipboard
fun Konture.assertNoCycles(includeTestConfigurations: Boolean)

Verifies that there are no module dependency cycles in the project. Throws an AssertionError if a cycle is detected.

Link copied to clipboard

Checks ratchet status and throws an AssertionError if resolved violations exist in the baseline and failOnResolvedViolations is enabled.

Link copied to clipboard

Access the class-level declarative assertion rule builder. Allows filtering and assertion of class structure, modifiers, annotations, visibility, and dependencies.

Filter or assertion criteria for classes.

Define and run class dependency/structural rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Filter or assertion criteria for class scope.

Link copied to clipboard

Filter or assertion criteria for class scope from module.

Link copied to clipboard

Synonym for scopeFromPackage retrieving a class-level functional KontureScope.

Synonym for scopeFromPackage retrieving a class-level functional KontureScope with source set filter.

Link copied to clipboard

Access the file-level declarative assertion rule builder. Allows filtering and assertion of source files and their imports, package, or wildcard usages.

fun Konture.files(sourceSets: SourceSetSelector, block: FilesRuleBuilder.() -> Unit)

Filter or assertion criteria for files.

Define and run source file dependency/structural rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Filter or assertion criteria for file scope.

Link copied to clipboard

Retrieves a file-level functional KontureFileScope scoped to a specific module path.

Filter or assertion criteria for file scope from module.

Link copied to clipboard

Retrieves a file-level functional KontureFileScope scoped to a specific package name.

Filter or assertion criteria for file scope from package.

Link copied to clipboard

Obtains a file scope containing files in the package of type parameter T.

Obtains a file scope containing files in the package of type.

Link copied to clipboard

Access the function-level declarative assertion rule builder. Allows filtering and assertion of function declarations (both top-level and nested member functions).

Filter or assertion criteria for functions.

Define and run function dependency/structural rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Filter or assertion criteria for function scope.

Link copied to clipboard

Retrieves a function-level functional KontureFunctionScope scoped to a specific module path.

Retrieves a function-level functional KontureFunctionScope scoped to a specific module path and source set.

Link copied to clipboard

Retrieves a function-level functional KontureFunctionScope scoped to a specific package name.

Retrieves a function-level functional KontureFunctionScope scoped to a specific package name and source set.

Link copied to clipboard

Obtains a function scope containing functions in the package of type parameter T.

Obtains a function scope containing functions in the package of type.

Link copied to clipboard

Define and run a nested, type-safe layered architecture specification. Automatically checks the layered rules at the end of the block.

Link copied to clipboard

Access the layered-architecture rule builder. Allows defining high-level layers and declaring directional access constraints between them.

Link copied to clipboard

Access the modules-level declarative assertion rule builder. Allows filtering and assertion of architectural module structures and dependencies.

Filter or assertion criteria for modules.

Define and run module dependency rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Filter or assertion criteria for module scope.

Link copied to clipboard

Retrieves a module-level functional KontureModuleScope scoped to a specific module path or pattern.

Filter or assertion criteria for module scope from module.

Link copied to clipboard

Access the property-level declarative assertion rule builder. Allows filtering and assertion of property declarations (both top-level and class properties).

Filter or assertion criteria for properties.

Define and run property dependency/structural rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Filter or assertion criteria for property scope.

Link copied to clipboard

Retrieves a property-level functional KonturePropertyScope scoped to a specific module path.

Retrieves a property-level functional KonturePropertyScope scoped to a specific module path and source set.

Link copied to clipboard

Retrieves a property-level functional KonturePropertyScope scoped to a specific package name.

Retrieves a property-level functional KonturePropertyScope scoped to a specific package name and source set.

Link copied to clipboard

Obtains a property scope containing properties in the package of type parameter T.

Obtains a property scope containing properties in the package of type.

Link copied to clipboard
fun reset()

Resets the current thread-local runtime state to default values and clears the shared report accumulator. Note: This method is intended for test harness setup and teardown.

Link copied to clipboard

Filter or assertion criteria for scope.

Link copied to clipboard

Retrieves a class-level functional KontureScope scoped to a specific module path.

Filter or assertion criteria for scope from module.

Link copied to clipboard

Retrieves a class-level functional KontureScope scoped to a specific package name.

Retrieves a class-level functional KontureScope scoped to a specific package name and source set.

Link copied to clipboard

Obtains a scope containing all files and declarations in the package of type parameter T.

Obtains a scope containing all files and declarations in the package of type.

Link copied to clipboard

Access the slice declarative assertion rule builder. Groups packages into slices by a capture-group pattern and asserts relationships between them, such as cycle-freedom.

fun Konture.slices(sourceSets: SourceSetSelector, block: SlicesRuleBuilder.() -> Unit)

Filter or assertion criteria for slices.

Define and run slice rules inside a block-based DSL context. Automatically checks the rules at the end of the block.

Link copied to clipboard

Retrieves a slice-level functional KontureSliceScope derived from a package pattern.

Filter or assertion criteria for slice scope.

Link copied to clipboard

Retrieves a slice-level functional KontureSliceScope derived from a module pattern.

Retrieves a slice-level functional KontureSliceScope derived from a module pattern and source set.

Link copied to clipboard

Retrieves a slice-level functional KontureSliceScope derived from a package pattern.

Retrieves a slice-level functional KontureSliceScope derived from a package pattern and source set.