Skip to content

Commit 1f93ff4

Browse files
committed
update sqlfluff action to use latest version
1 parent c7e0756 commit 1f93ff4

File tree

2 files changed

+28
-33
lines changed

2 files changed

+28
-33
lines changed

.github/workflows/lint_sqlfluff.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,43 @@
11
name: SQLFluff
22

33
on:
4-
- pull_request
4+
- push
55

66
jobs:
77
lint-mimic-iv:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: checkout
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
- name: Install Python
13-
uses: "actions/setup-python@v2"
13+
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.7"
15+
python-version: "3.12"
1616
- name: install sqlfluff
17-
run: "pip install sqlfluff==1.4.5"
17+
run: "pip install sqlfluff==3.5.0"
1818
- name: Get changed files
1919
id: get_file_changes
2020
uses: trilom/[email protected]
2121
with:
2222
output: ' '
2323
- name: Get changed .sql files in mimic-iv concepts folder
2424
id: get_files_to_lint
25-
shell: bash -l {0}
25+
shell: bash
2626
run: |
27-
# Set the command in the $() brackets as an output to use in later steps
28-
echo "lintees=$(
29-
echo \
30-
$(echo ${{ steps.get_file_changes.outputs.files_modified }} |
31-
tr -s ' ' '\n' |
32-
grep -E '^mimic-iv/concepts/.*[.]sql$' |
33-
tr -s '\n' ' ') \
34-
$(echo ${{ steps.get_file_changes.outputs.files_added }} |
35-
tr -s ' ' '\n' |
36-
grep -E '^mimic-iv/concepts/.*[.]sql$' |
37-
tr -s '\n' ' ')
38-
) >> $GITHUB_OUTPUT"
27+
# Compose list of changed SQL files under mimic-iv/concepts and export to step output
28+
files="$(echo "${{ steps.get_file_changes.outputs.files_modified }} ${{ steps.get_file_changes.outputs.files_added }}" \
29+
| tr -s ' ' '\n' \
30+
| grep -E '^mimic-iv/concepts/.*[.]sql$' \
31+
| tr -s '\n' ' ')"
32+
echo "lintees=${files}" >> "$GITHUB_OUTPUT"
3933
4034
- name: Lint SQL files
4135
id: sqlfluff_json
4236
if: steps.get_files_to_lint.outputs.lintees != ''
43-
shell: bash -l {0}
37+
shell: bash
4438
run: sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json
4539
- name: Annotate
46-
uses: yuzutech/annotations-action@v0.3.0
40+
uses: yuzutech/annotations-action@v0.5.0
4741
with:
4842
repo-token: "${{ secrets.GITHUB_TOKEN }}"
4943
title: "SQLFluff Lint"

.sqlfluff

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
[sqlfluff:core]
2-
rules = core,L019
3-
large_file_skip_byte_limit = 40000
1+
[sqlfluff]
42
dialect = bigquery
3+
large_file_skip_byte_limit = 40000
4+
exclude_rules = LT02
5+
6+
# Enable core rules plus explicit layout.commas (leading commas)
7+
[sqlfluff:core]
8+
rules = core,layout.commas
59

610
[sqlfluff:layout:type:comma]
711
line_position = leading
812

9-
[sqlfluff:indentation]
10-
indented_joins = false
11-
indented_using_on = true
12-
template_blocks_indent = false
13-
14-
[sqlfluff:rules:L010]
15-
# Keywords should be upper case
13+
# Capitalisation rules
14+
[sqlfluff:rules:capitalisation.keywords]
1615
capitalisation_policy = upper
1716

18-
[sqlfluff:rules:L030]
19-
# Functions should be upper case
20-
extended_capitalisation_policy = upper
17+
[sqlfluff:rules:capitalisation.functions]
18+
extended_capitalisation_policy = upper
19+
20+
[sqlfluff:rules:capitalisation.identifiers]
21+
extended_capitalisation_policy = lower

0 commit comments

Comments
 (0)