@codacy/tools-sqlint-0

中文文档
0.28.0发布于 2026/11/09MITTypeScriptCommonJS近 30 天下载 1.2万

SQLint adapter — CLI-mode SQL syntax checker

原始使用文档
文档目录6 节
  1. Table of Contents
  2. Overview
  3. Updating patterns
  4. Updating the SQLint version
  5. Development
  6. Notes for maintainers

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

PropertyValue
Tool IDSQLint
Codacy UUID25b6766b-06c6-4625-9df1-561d28386b5f
StrategyCLI
LanguagesSQL, PLSQL
Binarysqlint (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.json

The 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

  1. Update SQLINT_VERSION in src/adapter.ts
  2. Run pnpm prefetch to check for any changes
  3. Run pnpm test to verify compatibility
  4. 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 sqlint

Notes 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_query gem 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/ via GEM_HOME/GEM_PATH environment 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.

版本与发布记录

@codacy/tools-sqlint-0 共发布 31 个版本,首次发布于 2026/04/10;过去 12 个月发布了 31 个版本。

版本发布日期距今
0.28.0latest2026/11/09今天
0.27.12026/11/054 天前
0.27.02026/11/036 天前
0.26.02026/10/3010 天前
0.25.02026/10/1921 天前
0.24.02026/09/251 个月前

关于 @codacy/tools-sqlint-0 的常见问题

@codacy/tools-sqlint-0 是什么?

SQLint adapter — CLI-mode SQL syntax checker

如何安装 @codacy/tools-sqlint-0?

在项目目录运行 npm install @codacy/tools-sqlint-0,或使用 pnpm add / yarn add / bun add。

@codacy/tools-sqlint-0 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@codacy/tools-sqlint-0 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@codacy/tools-sqlint-0 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@codacy/tools-sqlint-0 可以商用吗?

@codacy/tools-sqlint-0 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@codacy/tools-sqlint-0 的下载量有多少?

根据 npm 官方下载统计,@codacy/tools-sqlint-0 在 2026/10/10 – 2026/11/08 这 30 天内被下载 11,765 次,日均约 392 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@codacy/tools-sqlint-0 还在维护吗?

最新版本 0.28.0 发布于 2026/11/09(今天);至今共发布 31 个版本,其中过去 12 个月发布了 31 个;首次发布于 2026/04/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。