Skip to content

Commit

Permalink
feat: add dbt linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Feb 14, 2024
1 parent 46f2fb9 commit 89de6e3
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 9 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci-dbt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: CI dbt
on:
pull_request:
paths: ['**.sql', '**.yaml']
jobs:
lint:
name: Lint dbt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v4
with:
cache: pip
python-version: '3.10'
- name: Install requirements
run: pip install -r requirements-dev.txt
- name: Lint sql
run: sqlfmt --diff .
- name: Lint yaml
run: yamlfix --exclude ".kubernetes/**/*" .
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Lint Dockerfile

---
name: CI Docker
on:
pull_request:

paths: [Dockerfile]
jobs:
docker_lint:
name: Lint Dockerfile
lint:
name: Lint dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
pip3 install -r requirements-actions.txt -r requirements.txt
pip3 install -r requirements-dev.txt -r requirements.txt
- name: Setup credentials
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/metadata_automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Install Python dependencies for actions
run: |-
pip install -r requirements-actions.txt
pip install -r requirements-dev.txt
- name: Checkout to the head ref
run: |-
Expand Down
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: no-commit-to-branch
args: [-b, main]
- id: trailing-whitespace
- repo: https://github.com/tconbeer/sqlfmt
rev: v0.20.0
hooks:
- id: sqlfmt
language_version: python
additional_dependencies: ['.[jinjafmt]']
- repo: local
hooks:
- id: yamlfix
name: yamlfix
types: [yaml]
language: system
entry: yamlfix --exclude ".kubernetes/**/*" .
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ logs:
.PHONY: status
status:
docker-compose ps

.PHONY: lint
lint:
pre-commit run --all-files
4 changes: 3 additions & 1 deletion requirements-actions.txt → requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pandas==1.4.2
requests==2.27.1
openpyxl==3.0.9
ruamel.yaml==0.17.21
arcgis==1.9.1
markdown==3.3.6
jinja2==2.11.3
pre-commit==3.6.1
shandy-sqlfmt==0.20.0
yamlfix==1.16.0

0 comments on commit 89de6e3

Please sign in to comment.