Skip to content

Commit

Permalink
fix sqlfluff
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJang27 committed Jul 9, 2024
1 parent c08593f commit 9af20c3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
11 changes: 10 additions & 1 deletion linters/sqlfluff/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ lint:
parser:
runtime: python
run: python3 ${plugin}/linters/sqlfluff/sqlfluff_to_sarif.py
- name: fix
version: ">=3.0.0"
run: sqlfluff fix ${target} --disable-progress-bar
output: rewrite
formatter: true
in_place: true
success_codes: [0, 1]
enabled: false
batch: true
- name: fix
run: sqlfluff fix ${target} --disable-progress-bar --force
output: rewrite
formatter: true
in_place: true
success_codes: [0]
success_codes: [0, 1]
enabled: false
batch: true
6 changes: 5 additions & 1 deletion linters/sqlfluff/sqlfluff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ const fmtCallbacks: TestCallback = (driver) => {
};

// An additional test to run 'sqlfluff fmt' with some additional test setup.
linterFmtTest({ linterName: "sqlfluff", namedTestPrefixes: ["basic_fmt"], preCheck: fmtCallbacks });
linterFmtTest({
linterName: "sqlfluff",
namedTestPrefixes: ["basic_fmt", "basic_check"],
preCheck: fmtCallbacks,
});
10 changes: 10 additions & 0 deletions linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.fmt.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing formatter sqlfluff test basic_check 1`] = `
"SELECT
*,
1,
blah AS foo
FROM myschema.mytable
"
`;
10 changes: 10 additions & 0 deletions linters/sqlfluff/test_data/sqlfluff_v2.0.0_basic_check.fmt.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing formatter sqlfluff test basic_check 1`] = `
"SELECT
*,
1,
blah AS foo
FROM myschema.mytable
"
`;
10 changes: 10 additions & 0 deletions linters/sqlfluff/test_data/sqlfluff_v3.0.0_basic_check.fmt.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing formatter sqlfluff test basic_check 1`] = `
"SELECT
*,
1,
blah AS foo
FROM myschema.mytable
"
`;

0 comments on commit 9af20c3

Please sign in to comment.