Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@
"ms-python.python",
"ms-toolsai.jupyter",
"njpwerner.autodocstring",
"quary.sqruff",
"redhat.vscode-yaml",
"shardulm94.trailing-spaces",
"sqlfluff.vscode-sqlfluff",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"yzhang.markdown-all-in-one"
]
],
"settings": {
"python.defaultInterpreterPath": "./.venv/bin/python",
"sqruff.executablePath": "${workspaceFolder}/.venv/bin/sqruff"
}
}
},
"containerEnv": {
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pytest-coverage.txt
.coveragerc
.env.local
.pre-commit-config.yaml
.sqlfluff
.sqruff
assets
LICENSE
noxfile.py
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
- "**.py"
- "**.sql"
- ".python-version"
- ".sqlfluff"
- ".sqruff"
- ".sqruffignore"
- "pyproject.toml"
- "ruff.toml"
- "uv.lock"
Expand All @@ -27,7 +28,7 @@ jobs:
- name: Format by Ruff
run: uv run nox -s fmt -- --ruff

sqlfluff:
sqruff:
runs-on: ubuntu-latest

steps:
Expand All @@ -37,5 +38,5 @@ jobs:
- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv

- name: Format by SQLFluff
run: uv run nox -s fmt -- --sqlfluff
- name: Format by sqruff
run: uv run nox -s fmt -- --sqruff
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
- "**.py"
- "**.sql"
- ".python-version"
- ".sqlfluff"
- ".sqruff"
- ".sqruffignore"
- "pyproject.toml"
- "ruff.toml"
- "ty.toml"
Expand All @@ -28,7 +29,7 @@ jobs:
- name: Lint by Ruff
run: uv run nox -s lint -- --ruff

sqlfluff:
sqruff:
runs-on: ubuntu-latest

steps:
Expand All @@ -38,8 +39,8 @@ jobs:
- name: Setup Python with uv
uses: ./.github/actions/setup-python-with-uv

- name: Lint by SQLFluff
run: uv run nox -s lint -- --sqlfluff
- name: Lint by sqruff
run: uv run nox -s lint -- --sqruff

ty:
runs-on: ubuntu-latest
Expand Down
54 changes: 30 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,49 @@ repos:
hooks:
- id: end-of-file-fixer
name: End of file fixer
description: "Ensure files end with a newline"
description: Ensure files end with a newline

- id: check-json
name: Check JSON
description: "Check that JSON files are valid"
description: Check that JSON files are valid

- id: check-toml
name: Check TOML
description: "Check that TOML files are valid"
description: Check that TOML files are valid

- id: check-xml
name: Check XML
description: "Check that XML files are valid"
description: Check that XML files are valid

- id: check-yaml
name: Check YAML
description: "Check that YAML files are valid"
description: Check that YAML files are valid

- id: detect-private-key
name: Detect private key
description: "Detect private keys in files"
description: Detect private keys in files

- id: trailing-whitespace
name: Trailing whitespace
description: "Remove trailing whitespace from files"
description: Remove trailing whitespace from files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.8
hooks:
- id: ruff-format
name: Python Format
description: Run 'ruff format' for extremely fast Python formatting

- id: ruff
name: Ruff check
description: "Run 'ruff check' for extremely fast Python linting"
name: Python Lint
description: Run 'ruff check' for extremely fast Python linting
args: [--fix]

- id: ruff-format
name: Ruff format
description: "Run 'ruff format' for extremely fast Python formatting"

- repo: local
hooks:
- id: ty
name: ty check
name: Python Type Check
description: Run 'ty check' for Python type checking
entry: uv run ty check
language: python
types: [python]
Expand All @@ -56,28 +57,33 @@ repos:
rev: v1.7.10
hooks:
- id: actionlint
name: GitHub Actions Lint
description: Lint GitHub Actions workflows

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint
name: Lint Dockerfiles
name: Dockerfile Lint
description: Runs hadolint to lint Dockerfiles
language: system
types: ["dockerfile"]
types: [dockerfile]
entry: hadolint

- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.5.0
- repo: local
hooks:
- id: sqlfluff-lint
name: SQLFluff Lint
description: "Lints sql files with `SQLFluff`"
- id: sqruff-fix
name: SQL Format
description: Run 'sqruff fix' for SQL formatting
entry: uv run sqruff fix
language: python
types: [sql]

- id: sqlfluff-fix
name: SQLFluff Fix
description: "Fixes sql lint errors with `SQLFluff`"
- id: sqruff-lint
name: SQL Lint
description: Run 'sqruff lint' for SQL linting
entry: uv run sqruff lint
language: python
types: [sql]
Comment thread
a5chin marked this conversation as resolved.

ci:
Expand Down
14 changes: 0 additions & 14 deletions .sqlfluff

This file was deleted.

15 changes: 15 additions & 0 deletions .sqruff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[sqruff]
dialect = bigquery
templater = jinja
sql_file_exts = .sql
max_line_length = 80
exclude_rules =
rules = all

[sqruff:indentation]
indent_unit = space
tab_space_size = 2
indented_joins = True

[sqruff:rules:ambiguous.join]
fully_qualify_join_types = both
1 change: 0 additions & 1 deletion .sqlfluffignore → .sqruffignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,3 @@ cython_debug/
# dbt
dbt_packages/
logs/
target/
8 changes: 7 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
"apdisk",
"autoflake",
"autolabeler",
"basedpyright",
"beartype",
"buildkit",
"buildx",
"caplog",
"celerybeat",
"charliermarsh",
"classmethod",
"codebook",
"commitable",
"configfile",
"connor",
Expand Down Expand Up @@ -86,6 +88,7 @@
"pytype",
"pyupgrade",
"qodo",
"quary",
"redoc",
"reviewdog",
"rootdir",
Expand All @@ -98,14 +101,17 @@
"spyderproject",
"spyproject",
"sqlalchemy",
"sqlfluff",
"sqruff",
"sqruffignore",
"stmts",
"superfences",
"tamasfe",
"templater",
"testpaths",
"timemachine",
"tombi",
"toolsai",
"trunc",
"typer",
"uline",
"unittests",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"njpwerner.autodocstring",
"oderwat.indent-rainbow",
"pkief.material-icon-theme",
"quary.sqruff",
"redhat.vscode-yaml",
"shardulm94.trailing-spaces",
"sqlfluff.vscode-sqlfluff",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"usernamehw.errorlens",
Expand Down
8 changes: 2 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnSave.enabled": true,
"python.defaultInterpreterPath": ".venv/bin/python",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.languageServer": "None",
"python.testing.autoTestDiscoverOnSaveEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"sqlfluff.config": ".sqlfluff",
"sqlfluff.executablePath": ".venv/bin/sqlfluff",
"sqlfluff.format.enabled": true,
"sqlfluff.linter.run": "onType",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
Expand Down Expand Up @@ -52,7 +48,7 @@
"editor.tabSize": 4
},
"[sql]": {
"editor.defaultFormatter": "sqlfluff.vscode-sqlfluff",
"editor.defaultFormatter": "Quary.sqruff",
"editor.tabSize": 2
},
"[toml]": {
Expand Down
2 changes: 2 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
"tab_size": 4
},
"SQL": {
"language_servers": ["sqruff"],
"formatter": {
"language_server": { "name": "sqruff" }
},
"format_on_save": "on",
"tab_size": 2
},
"TOML": {
Expand Down
25 changes: 12 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ uv run pytest
# Format code with Ruff
uv run nox -s fmt -- --ruff

# Format SQL files with SQLFluff
uv run nox -s fmt -- --sqlfluff
# Format SQL files with sqruff
uv run nox -s fmt -- --sqruff

# Format both Python and SQL
uv run nox -s fmt -- --ruff --sqlfluff
uv run nox -s fmt -- --ruff --sqruff

# Lint with all tools (Ruff, SQLFluff, ty)
uv run nox -s lint -- --ruff --sqlfluff --ty
# Lint with all tools (Ruff, sqruff, ty)
uv run nox -s lint -- --ruff --sqruff --ty

# Lint with Ruff only
uv run nox -s lint -- --ruff

# Lint SQL files only
uv run nox -s lint -- --sqlfluff
uv run nox -s lint -- --sqruff

# Lint with ty only
uv run nox -s lint -- --ty
Expand All @@ -67,9 +67,9 @@ uv run nox -s lint -- --ty
uv run ruff check . --fix
uv run ruff format .

# Run SQLFluff directly
uv run sqlfluff lint .
uv run sqlfluff fix .
# Run sqruff directly
uv run sqruff lint
uv run sqruff fix

# Run ty directly
uv run ty check
Expand Down Expand Up @@ -176,11 +176,10 @@ Tests in `tests/tools/` mirror the package structure:
- Reports: HTML + terminal
- Import mode: importlib

**SQLFluff (.sqlfluff)**:
**sqruff (.sqruff)**:
- Dialect: BigQuery
- Max line length: 80
- Tab space size: 2
- Custom rules for join qualification and unused joins

### Nox Task Automation

Expand All @@ -199,8 +198,8 @@ def lint(session: nox.Session) -> None:
session.run("uv", "run", "ty", "check")
if args.ruff:
session.run("uv", "run", "ruff", "check", ".", "--fix")
if args.sqlfluff:
session.run("uv", "run", "sqlfluff", "lint", ".")
if args.sqruff:
session.run("uv", "run", "sqruff", "lint")
```

## Key Patterns for Development
Expand Down
Loading
Loading