@codacy/tools-sqlint-0
v0.3.5
Published
SQLint adapter — CLI-mode SQL syntax checker
Readme
@codacy/tools-sqlint-0
Table of Contents
Overview
SQL syntax checker using the SQLint Ruby gem. Uses the CLI execution strategy -- spawns sqlint via spawnTool() and parses its text output.
| Property | Value |
| ------------- | -------------------------------------- |
| Tool ID | SQLint |
| Codacy UUID | 25b6766b-06c6-4625-9df1-561d28386b5f |
| Strategy | CLI |
| Languages | SQL, PLSQL |
| Binary | sqlint (installed via gem install) |
| File patterns | **/*.sql |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonThe prefetch script calls packages/tools/scripts/fetch-patterns.mjs with the tool UUID to download pattern metadata from the Codacy API.
SQLint has a single umbrella pattern: SQLint_allIssues. All syntax errors map to this one pattern.
Updating the SQLint version
- Update
SQLINT_VERSIONinsrc/adapter.ts - Run
pnpm prefetchto check for any changes - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
sqlint-1/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (requires ruby + sqlint in PATH for integration tests)To install sqlint locally for testing:
gem install sqlintNotes for maintainers
- PostgreSQL-only: SQLint uses
pg_query(libpg_query) under the hood, which means it only validates PostgreSQL dialect SQL. Non-PostgreSQL syntax may produce false positives. - Ruby gem dependency: SQLint requires Ruby >= 2.7 as a runtime. The adapter uses
ensureRuby()to download a portable Ruby if no system Ruby is found. - Native compilation: The
pg_querygem includes a native C extension that compiles libpg_query during installation. A C compiler (gcc/clang) and make are required on the system. - Gems are installed in an isolated directory at
~/.codacy/runtimes/sqlint-0/gems/viaGEM_HOME/GEM_PATHenvironment variables. - Output format is plain text, one finding per line:
file.sql:line:column:SEVERITY message. - Exit codes: 0 = no errors, 1 = errors found (both are success states for the adapter).
- SQLint has no configuration files -- it always checks all syntax.
- All findings map to the single umbrella pattern
SQLint_allIssues.
