Skip to main content
SQLFluff is a dialect-flexible SQL linter for standardizing SQL code. CodeRabbit runs SQLFluff in a secure sandbox and reports lint findings on changed SQL files. CodeRabbit runs SQLFluff v4.5.0.

Files

SQLFluff runs on files with the .sql extension.

Configuration

boolean
default:true
Enable SQLFluff
string
Optional path to the SQLFluff configuration file relative to the repository. Use this when the config file is not named one of SQLFluff’s default filenames.
.coderabbit.yaml
When config_file is not set, or the file it names is missing or isn’t a valid SQLFluff config, CodeRabbit looks for these SQLFluff config files:
  • setup.cfg
  • tox.ini
  • pep8.ini
  • .sqlfluff
  • pyproject.toml
CodeRabbit uses a SQLFluff config file only when it contains a [sqlfluff] or [tool.sqlfluff] section. If no valid SQLFluff config file is found, CodeRabbit writes a temporary config based on the selected review profile and detected SQL dialect.

Profile behavior

When no valid SQLFluff config file is found, CodeRabbit generates a temporary config whose rule set depends on the active review profile:
  • Chill uses a narrow default rule set focused on SQL issues that can cause incorrect results or runtime failures, including bare UNION, mismatched set-operation column counts, implicit cross joins, duplicate table aliases, and NULL comparisons with = or !=.
  • Assertive uses a broader semantic and structural rule set, including checks for unused aliases or CTEs, duplicate aliases, identifier portability, unnecessary CASE expressions, misleading DISTINCT syntax, unreferenced joined tables, and T-SQL procedure issues. Layout, capitalization, style-preference, and high-noise reference rules remain excluded.

dbt templater support

CodeRabbit includes sqlfluff-templater-dbt 4.4.0, dbt-core 1.10.22, and dbt-duckdb 1.11.0 with its SQLFluff installation. When your SQLFluff config sets templater = dbt, CodeRabbit can compile dbt-templated SQL for linting without requiring your repository to provide the Python templater package. Before running the dbt templater, CodeRabbit attempts a bounded dbt deps preflight when the project contains packages.yml or dependencies.yml and its configured package directory does not already exist. Dependencies are staged in an isolated temporary project and exposed to the real project for linting through a temporary link. Existing package directories and lock files are preserved. Manifests containing local: package entries skip this optional preflight. Preflight failures are non-blocking: CodeRabbit still runs SQLFluff when possible, then removes only its temporary project, link, and any empty parent directories it created. CodeRabbit resolves dbt projects in repository subdirectories by passing the project directory through DBT_PROJECT_DIR. Every SQLFluff invocation uses a temporary CodeRabbit-controlled profiles directory and an in-memory DuckDB profile named coderabbit with target safe. This overrides repository and environment selections for profile, profiles_dir, and target. Repository profiles.yml files are not loaded or rewritten.

Security policy and restrictions

SQLFluff runs in a secure sandbox using CodeRabbit’s installed SQLFluff, dbt templater, and DuckDB adapter packages. CodeRabbit does not install repository-provided Python packages, custom SQLFluff plugins, third-party dbt adapters, or custom templaters for this integration. Repository-provided Jinja Python libraries and dbt profile or plugin imports are disabled. SQLFluff linting runs without network access; the optional dbt deps preflight uses the sandbox’s public network access to fetch packages. DuckDB external file and network access, automatic extension installation and loading, and community or unsigned extensions are disabled, and these settings are locked for the run.
Custom plugins, third-party dbt adapters, and custom templaters that require repository-provided Python packages are not supported.

When CodeRabbit skips SQLFluff

CodeRabbit skips SQLFluff when:
  • SQLFluff is disabled in CodeRabbit settings.
  • The pull request does not include changed .sql files.
  • SQLFluff is already running in GitHub Actions, GitLab CI, CircleCI, or Azure Pipelines.

Ignored codes

The following SQLFluff codes are automatically ignored:

What’s next

All supported tools

Browse the complete list of linters, security analyzers, and CI/CD integrations available in CodeRabbit.

Tools reference

Explore detailed specifications and capabilities of all available CodeRabbit tools.

Configuration reference

Full reference for all available options, including how to enable, disable, and tune individual tools.