Package-level declarations

Types

Link copied to clipboard

Refines diagnostics emitted by a rule.

Link copied to clipboard

Creates fresh diagnostic refinement instances for thread-safe analysis.

Link copied to clipboard
fun interface DiagnosticReporter

Receives diagnostics emitted by a rule.

Link copied to clipboard
interface KeyedEnum

Enum contract for rule options parsed by stable keys instead of enum names.

Link copied to clipboard
interface Rule

Lint or formatting rule contributed by a rule set.

Link copied to clipboard
interface RuleContext

Stable analysis view exposed to custom rules.

Link copied to clipboard
class RuleDeprecation(val message: String, val replacement: QualifiedRuleId? = null)

Deprecation metadata for a rule that remains available for explicit users.

Link copied to clipboard
interface RuleOption<T>

Typed declaration for one rule option.

Link copied to clipboard
class RuleOptionDeprecation(val message: String, val replacement: String? = null)

Deprecation metadata for a rule option that remains available for explicit users.

Link copied to clipboard
class RuleOptions(values: Map<String, String> = emptyMap())

Resolved options for the rule currently being executed.

Link copied to clipboard
fun interface RuleProvider

Creates fresh rule instances for thread-safe analysis.

Link copied to clipboard
interface RuleSetProvider

Provides a named collection of rules.

Link copied to clipboard
class SqlFacts(val statements: List<SqlStatementFacts> = emptyList())

Stable SQL structure facts exposed to custom rules.

Link copied to clipboard
class SqlJoinFacts(val range: SourceRange, val kind: String, val table: SqlTableReferenceFacts)

Stable facts for a JOIN clause.

Link copied to clipboard
class SqlQualifiedReferenceFacts(val range: SourceRange, val qualifier: String, val name: String)

Stable facts for a qualified reference such as table.column.

Link copied to clipboard
class SqlResultColumnFacts(val range: SourceRange, val alias: String? = null, val wildcard: Boolean = false)

Stable facts for a SELECT result column.

Link copied to clipboard
class SqlSelectFacts(val selectListRange: SourceRange, val resultColumns: List<SqlResultColumnFacts>)

Stable facts for a SELECT statement.

Link copied to clipboard
class SqlStatementFacts(val kind: SqlStatementKind, val range: SourceRange, val select: SqlSelectFacts? = null, val tableReferences: List<SqlTableReferenceFacts> = emptyList(), val joins: List<SqlJoinFacts> = emptyList(), val qualifiedReferences: List<SqlQualifiedReferenceFacts> = emptyList())

Stable facts for one top-level SQL statement.

Link copied to clipboard

Coarse statement kinds used by parser-backed rules.

Link copied to clipboard
class SqlTableReferenceFacts(val range: SourceRange, val name: String? = null, val alias: String? = null, val subquery: Boolean = false)

Stable facts for a table or derived-table reference.

Link copied to clipboard
class SqlToken(val text: String, val startOffset: Int, val endOffset: Int)

SQL-like source token outside comments and quoted text.

Link copied to clipboard
class SqlTokenMatch(val startToken: SqlToken, val endToken: SqlToken)

A matched range in a SQL token list.

Functions

Link copied to clipboard

Declares a strict boolean rule option and exposes it as a property delegate.

fun booleanOption(name: String, defaultValue: Boolean, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<Boolean>>

Declares a strict boolean rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Returns true when a source pattern match for role exists.

Link copied to clipboard
inline fun <T : Enum<T>> enumListOption(name: String, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<T>?>>

Declares a comma-separated enum list rule option and exposes it as a property delegate.

inline fun <T : Enum<T>> enumListOption(name: String, defaultValue: List<T>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<T>>>

Declares a comma-separated enum list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
inline fun <T : Enum<T>> enumOption(name: String, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<T?>>

Declares an enum rule option and exposes it as a property delegate.

inline fun <T : Enum<T>> enumOption(name: String, defaultValue: T, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<T>>

Declares an enum rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Returns the first source pattern match for role.

Link copied to clipboard

Returns the first ordered sequence of source pattern matches.

Link copied to clipboard

Declares a comma-separated integer list rule option and exposes it as a property delegate.

fun intListOption(name: String, defaultValue: List<Int>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<Int>>>

Declares a comma-separated integer list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares an integer rule option and exposes it as a property delegate.

fun intOption(name: String, defaultValue: Int, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<Int>>

Declares an integer rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Returns true when this token matches value ignoring case.

Link copied to clipboard

Declares a comma-separated keyed enum list rule option and exposes it as a property delegate.

inline fun <T : Enum<T>, KeyedEnum> keyedEnumListOption(name: String, defaultValue: List<T>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<T>>>

Declares a comma-separated keyed enum list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
inline fun <T : Enum<T>, KeyedEnum> keyedEnumOption(name: String, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<T?>>

Declares a keyed enum rule option and exposes it as a property delegate.

inline fun <T : Enum<T>, KeyedEnum> keyedEnumOption(name: String, defaultValue: T, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<T>>

Declares a keyed enum rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
fun <T> listOption(name: String, deprecation: RuleOptionDeprecation? = null, itemParser: (String) -> T): ReadOnlyProperty<Rule, RuleOption<List<T>?>>

Declares a comma-separated list rule option and exposes it as a property delegate.

fun <T> listOption(name: String, defaultValue: List<T>, deprecation: RuleOptionDeprecation? = null, itemParser: (String) -> T): ReadOnlyProperty<Rule, RuleOption<List<T>>>

Declares a comma-separated list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a comma-separated long integer list rule option and exposes it as a property delegate.

fun longListOption(name: String, defaultValue: List<Long>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<Long>>>

Declares a comma-separated long integer list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a long integer rule option and exposes it as a property delegate.

fun longOption(name: String, defaultValue: Long, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<Long>>

Declares a long integer rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
fun String.maskSqlCommentsAndQuotedText(hashLineComments: Boolean = false): String

Replaces comments and quoted text with spaces while preserving offsets.

Link copied to clipboard

Declares a non-blank string rule option and exposes it as a property delegate.

Declares a non-blank string rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a comma-separated non-negative integer list rule option and exposes it as a property delegate.

Declares a comma-separated non-negative integer list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a non-negative integer rule option and exposes it as a property delegate.

fun nonNegativeIntOption(name: String, defaultValue: Int, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<Int>>

Declares a non-negative integer rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
fun <T> option(name: String, deprecation: RuleOptionDeprecation? = null, parser: (String) -> T): ReadOnlyProperty<Rule, RuleOption<T?>>

Declares a custom typed rule option and exposes it as a property delegate.

fun <T> option(name: String, defaultValue: T, deprecation: RuleOptionDeprecation? = null, parser: (String) -> T): ReadOnlyProperty<Rule, RuleOption<T>>

Declares a custom typed rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Converts a source offset into a 1-based line/column position.

Link copied to clipboard

Declares a comma-separated positive integer list rule option and exposes it as a property delegate.

fun positiveIntListOption(name: String, defaultValue: List<Int>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<Int>>>

Declares a comma-separated positive integer list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a positive integer rule option and exposes it as a property delegate.

fun positiveIntOption(name: String, defaultValue: Int, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<Int>>

Declares a positive integer rule option with a default value and exposes it as a property delegate.

Link copied to clipboard
fun String.rangeAtOffsets(startOffset: Int, endOffset: Int): SourceRange

Converts source offsets into a 1-based line/column range.

Link copied to clipboard
fun Rule.reportSqlStatementMatches(context: RuleContext, reporter: DiagnosticReporter, message: String, hashLineComments: Boolean = false, findMatch: (statement: List<SqlToken>) -> SqlTokenMatch?)

Tokenizes the current file and reports matches found per statement.

Link copied to clipboard
fun Rule.reportSqlTokenMatch(context: RuleContext, reporter: DiagnosticReporter, message: String, match: SqlTokenMatch)

Reports a diagnostic for match using this rule's default severity.

Link copied to clipboard

Splits a token stream into statements at semicolon tokens.

Link copied to clipboard
fun String.sqlTokens(hashLineComments: Boolean = false): Sequence<SqlToken>

Tokenizes SQL-like identifiers, numbers, and semicolons outside comments and quoted text.

Link copied to clipboard

Declares a comma-separated string list rule option and exposes it as a property delegate.

fun stringListOption(name: String, defaultValue: List<String>, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<List<String>>>

Declares a comma-separated string list rule option with a default value and exposes it as a property delegate.

Link copied to clipboard

Declares a raw string rule option and exposes it as a property delegate.

fun stringOption(name: String, defaultValue: String, deprecation: RuleOptionDeprecation? = null): ReadOnlyProperty<Rule, RuleOption<String>>

Declares a raw string rule option with a default value and exposes it as a property delegate.