npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codacy/tools-sqlfluff-3

v0.3.5

Published

SQLFluff adapter — CLI-mode SQL linter

Downloads

479

Readme

@codacy/tools-sqlfluff-3

Table of Contents


Overview

Multi-dialect SQL linter using SQLFluff. Uses the CLI execution strategy -- spawns sqlfluff lint --format json from a managed Python venv via spawnTool() and parses its JSON output.

| Property | Value | | ------------- | -------------------------------------- | | Tool ID | SQLFluff | | Codacy UUID | eebd5ab6-3bef-4192-843c-f52bc4dce861 | | Strategy | CLI | | Languages | SQL | | Binary | sqlfluff (pip-installed in venv) | | 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.

Pattern IDs follow the format SQLFluff_AL01_aliasing.table, SQLFluff_LT01_layout.spacing, etc. -- they include both the short code and the rule name.

Updating the SQLFluff version

  1. Update preferredVersion in src/adapter.ts
  2. Update the PIP_PACKAGES array with the new pinned version
  3. Run pnpm prefetch to check for new/removed rules
  4. Run pnpm test to verify compatibility
  5. If the major version changes, create a new adapter package (sqlfluff-4/)

Development

pnpm build    # Build with tsup
pnpm test     # Run tests (requires sqlfluff in PATH or venv)

To install sqlfluff locally for testing:

pip install sqlfluff==3.3.0

Notes for maintainers

  • Multi-dialect support: SQLFluff supports ANSI, PostgreSQL, MySQL, BigQuery, Snowflake, and many more SQL dialects. The generated config defaults to dialect = ansi. Users can override this via a local .sqlfluff config file.
  • Python pip dependency: SQLFluff requires Python 3 as a runtime. The adapter uses an isolated venv at ~/.codacy/runtimes/sqlfluff-3/venv/.
  • Pattern ID mapping: SQLFluff's JSON output reports code (e.g. AL01) but Codacy pattern IDs include both code and name (e.g. SQLFluff_AL01_aliasing.table). The adapter builds a CODE_TO_PATTERN reverse lookup map from patterns.json at module initialization.
  • Config generation: When patterns are enabled but no local config exists, the adapter generates a .sqlfluff INI file in .codacy/generated/ with dialect = ansi, templater = raw, and a rules list derived from the enabled pattern codes.
  • Exit code 0 = no violations, 1 = violations found (normal), 2 = error.
  • start_line_no and start_line_pos in sqlfluff's JSON output are 1-based, matching Codacy's convention.
  • Config file detection only checks for .sqlfluff in the repository root.
  • Pattern filtering is both config-level (generated config only enables the requested rules) and post-hoc (results are filtered by enabled pattern IDs as a safety net).