Package-level declarations

Types

Link copied to clipboard
class DatabaseContext(val name: String, val dialect: SqlDialect)

Lightweight SQLDelight database context visible to rules and reporters.

Link copied to clipboard
class Diagnostic(val ruleId: QualifiedRuleId, val severity: Severity, val message: String, val file: SourceFile?, val range: SourceRange?, val database: DatabaseContext?, val fixes: List<Fix> = emptyList())

Diagnostic resolved by the engine and passed to reporters.

Link copied to clipboard
class DialectId(val id: String)

SQL dialect identifier used by rules and reports without depending on artifact names.

Link copied to clipboard
class Fix(val title: String, val safety: FixSafety, val edits: List<TextEdit>)

A fix proposed by a rule diagnostic.

Link copied to clipboard

Safety classification for a write operation proposed by a rule or formatter.

Link copied to clipboard
@RequiresOptIn(message = "This API is public for sqldelight-check internals and may change without source compatibility.", level = RequiresOptIn.Level.ERROR)
annotation class InternalSqldelightCheckApi

Marks API that is public only for sqldelight-check module boundaries.

Link copied to clipboard

Controls how much execution detail sqldelight-check should emit.

Link copied to clipboard
class QualifiedRuleId(val ruleSetId: RuleSetId, val ruleId: RuleId)

Identifies a rule after combining a rule set ID and a rule-local ID.

Link copied to clipboard
class RuleDiagnostic(val severity: Severity, val message: String, val file: SourceFile?, val range: SourceRange?, val database: DatabaseContext?, val fixes: List<Fix> = emptyList())

Diagnostic emitted by a rule before the engine attaches the containing rule set.

Link copied to clipboard
value class RuleId(val value: String)

Identifies a rule within its containing rule set.

Link copied to clipboard
value class RuleSetId(val value: String)

Identifies a rule set such as standard or a third-party provider ID.

Link copied to clipboard

Severity assigned to a diagnostic after rule defaults and user configuration are resolved.

Link copied to clipboard
class SourceFile(val path: String, val content: String)

Source file known to sqldelight-check.

Link copied to clipboard

SQLDelight source file kind inferred from the file extension.

Link copied to clipboard
class SourcePosition(val line: Int, val column: Int)

One-based source position for diagnostics and edits.

Link copied to clipboard
class SourceRange(val start: SourcePosition, val end: SourcePosition)

Source range in a file.

Link copied to clipboard
class SqlDialect(val ids: Set<DialectId> = setOf(DialectId.Unknown), val sourcePatterns: SqlDialectSourcePatterns = SqlDialectSourcePatterns.SourceScannerDefault)

Rule-relevant SQL dialect metadata for a SQLDelight database.

Link copied to clipboard
class SqlDialectCoordinate(val group: String, val module: String, val version: String?)

Gradle module coordinate for a SQLDelight dialect artifact.

Link copied to clipboard
fun interface SqlDialectProvider

Resolves rule-relevant dialect metadata for a SQLDelight dialect artifact.

Link copied to clipboard
class SqlDialectSourceBlockPatterns(statementSeparatorTerms: Set<String> = defaultSqlDialectStatementSeparatorTerms, val parenthesisDepthTerms: Set<SqlDialectSourceParenthesisDepthTerms> = defaultSqlDialectParenthesisDepthTerms, val clauseStartRoles: Set<SqlDialectSourcePatternRole> = defaultSqlDialectClauseStartRoles, val pairedBlocks: Set<SqlDialectSourcePairedBlockPattern> = defaultSqlDialectPairedBlocks, val parenthesizedBlocks: Set<SqlDialectSourceParenthesizedBlockPattern> = defaultSqlDialectParenthesizedBlocks)

Dialect-specific patterns used to derive conservative SQL source blocks.

Link copied to clipboard

A paired source block pattern such as CASE ... END.

Link copied to clipboard
class SqlDialectSourceParenthesisDepthTerms(val openTerm: String, val closeTerm: String)

Terms that adjust source parenthesis nesting depth.

class SqlDialectSourceParenthesizedBlockPattern(val openTerm: String, val closeTerm: String, val defaultKind: SqlSourceBlockKind, val innerStartRoles: Set<SqlDialectSourcePatternRole> = emptySet(), val innerStartKind: SqlSourceBlockKind = defaultKind)

A source block pattern opened and closed by fixed terms.

Link copied to clipboard

A dialect source pattern and the scanner roles it fulfills.

Link copied to clipboard

A dialect source pattern expression such as ORDER BY, LEFT [OUTER] JOIN, FETCH {FIRST|NEXT}, or FETCH {FIRST|NEXT} [ROW|ROWS].

Link copied to clipboard
class SqlDialectSourcePatternPart(alternatives: Set<String>, val optional: Boolean = false)

One part in a dialect source pattern expression.

Link copied to clipboard

The source-scanner meaning attached to a dialect pattern.

Link copied to clipboard
class SqlDialectSourcePatterns(val patterns: Set<SqlDialectSourcePattern> = SourceScannerDefault.patterns, val blockPatterns: SqlDialectSourceBlockPatterns = SqlDialectSourceBlockPatterns.Default)

Dialect-specific source patterns used by conservative source-text scanners.

Link copied to clipboard

A SQL source term that source-text rules may need to recognize directly.

Link copied to clipboard
class SqlSourceBlock(val kind: SqlSourceBlockKind, val startTokenIndex: Int, val endTokenIndex: Int, val startOffset: Int, val endOffset: Int, val statementIndex: Int, val parentBlockIndex: Int?, val sourcePatternMatch: SqlSourcePatternMatch? = null)

A syntactic source block derived from dialect-aware source tokens.

Link copied to clipboard

The conservative syntactic meaning of a SQL source block.

Link copied to clipboard
class SqlSourcePatternMatch(val pattern: SqlDialectSourcePattern, val length: Int)

A dialect source pattern match that starts at a source token.

Link copied to clipboard

Dialect-aware source structure for conservative SQL source scanners.

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

A source token used by conservative SQL source scanners.

Link copied to clipboard
class SqlSourceTokenContext(val token: SqlSourceToken, val index: Int, val statementIndex: Int, val parenthesisDepth: Int, val caseDepth: Int, val patternMatches: Set<SqlSourcePatternMatch>)

A SQL source token with its surrounding source structure.

Link copied to clipboard
class TextEdit(val range: SourceRange, val replacement: String)

Text edit represented as a replacement over a source range.

Functions

Link copied to clipboard

Returns the offset immediately after a bracket-quoted SQL identifier.

Link copied to clipboard
fun String.skipSqlQuoted(start: Int, quote: Char): Int

Returns the offset immediately after a SQL quoted range that starts at start.

Link copied to clipboard

Parses source pattern expressions and attaches roles to each pattern.

Link copied to clipboard

Removes patterns whose expression exactly matches one of expressions.