diff options
| author | Fuwn <[email protected]> | 2021-05-20 15:05:21 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-20 15:05:21 +0000 |
| commit | 8efe777fdf8235168703f1dc21696dc6e376b6ca (patch) | |
| tree | 098c5fe2599101d4ce2225301cf6050b72613624 | |
| parent | style(migrations): fix sql linting errors (diff) | |
| download | whirl-8efe777fdf8235168703f1dc21696dc6e376b6ca.tar.xz whirl-8efe777fdf8235168703f1dc21696dc6e376b6ca.zip | |
ci: sql linting on commit, make task
| -rw-r--r-- | .husky/pre-commit | 8 | ||||
| -rw-r--r-- | Makefile.toml | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/.husky/pre-commit b/.husky/pre-commit index 58248c1..82d5a4b 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,12 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" +# Check if formatting in Rust source files is per standard. cargo fmt + +# Check if SQLFluff is installed on the system, if it is, run the linting +# subroutine on SQL source files. +if command -v sqlfluff > /dev/null; then + sqlfluff lint migrations/ +fi + diff --git a/Makefile.toml b/Makefile.toml index 9587474..5894341 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -132,3 +132,9 @@ workspace = false dependencies = ["ask-github-token"] command = "act" args = ["-s", "GITHUB_TOKEN=${GITHUB_TOKEN}"] + +[tasks.lint-sql] +workspace = false +command = "sqlfluff" +args = ["lint", "./migrations/"] + |