Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sqlfluff fix command #822

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
"
`;
Loading