Package-level declarations

Types

Link copied to clipboard
fun interface DiagnosticReporter

Receives diagnostics emitted by a rule.

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
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.

Properties

Link copied to clipboard

Default enablement derived from Rule.defaultEnable.

Functions

Link copied to clipboard
fun Map<String, String>.booleanOption(name: String, defaultValue: Boolean): Boolean

Reads a strict boolean option from rule configuration.

Link copied to clipboard

Reads a comma-separated string list from rule configuration.

Link copied to clipboard

Returns true when a source pattern match for role exists.

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

Returns true when this token matches value ignoring case.

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

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

Link copied to clipboard
fun Map<String, String>.positiveIntOption(name: String, defaultValue: Int): Int

Reads a positive integer option from rule configuration.

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.