Skip to content

Commit

Permalink
Add .pre-commit-config.yaml (#78)
Browse files Browse the repository at this point in the history
* Add `.pre-commit-config.yaml`

Signed-off-by: Yu ISHIKAWA <yuu.ishikawa+github@gmail.com>

* Update

Signed-off-by: Yu ISHIKAWA <yuu.ishikawa+github@gmail.com>

* Update

Signed-off-by: Yu ISHIKAWA <yuu.ishikawa+github@gmail.com>

* test

Signed-off-by: Yu ISHIKAWA <yuu.ishikawa+github@gmail.com>

---------

Signed-off-by: Yu ISHIKAWA <yuu.ishikawa+github@gmail.com>
  • Loading branch information
yu-iskw committed Apr 11, 2023
1 parent a28280f commit 82e2959
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- repo: https://github.com/rhysd/actionlint
rev: main
hooks:
- id: actionlint
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.9-slim

ENV REVIEWDOG_VERSION="v0.13.0"
ENV REVIEWDOG_VERSION="v0.14.1"

ENV WORKING_DIRECTORY="/workdir"
WORKDIR "$WORKING_DIRECTORY"
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
setup-dev:
SQLFLUFF_VERSION=1.2.0 pip install -r requirements/requirements.txt
SQLFLUFF_VERSION=1.2.0 pip install --force-reinstall -r requirements/requirements.txt
pre-commit install

lint: lint-shell lint-json lint-docker

lint-shell:
shellcheck entrypoint.sh

lint-json:
cat "to-rdjson.jq" | jq empty > /dev/null 2>&1; echo "$?"

lint-docker:
hadolint Dockerfile
9 changes: 6 additions & 3 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
sqlfluff==${SQLFLUFF_VERSION}
sqlfluff-templater-dbt==${SQLFLUFF_VERSION}
setuptools>=65.5.1
pre-commit==2.15.0

# `CompilationException` is no longer implemented from dbt-core==1.4.0.
# So we have to use dbt-core 1.3 or less, until the subsequent fix is released.
# SEE https://github.com/sqlfluff/sqlfluff/pull/4317
dbt-core<1.4
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability

# sqlfluff
sqlfluff==${SQLFLUFF_VERSION}
sqlfluff-templater-dbt==${SQLFLUFF_VERSION}
2 changes: 1 addition & 1 deletion testdata/test_failed_dbt/models/staging/staging_test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

SELECT
1 AS x,
2 AS y,
2 AS y,
3 AS z

0 comments on commit 82e2959

Please sign in to comment.