From ef0ae032f281b40b79bf105d58eaeb8216c5c4d7 Mon Sep 17 00:00:00 2001 From: Noah Davis <11672+noahd1@users.noreply.github.com> Date: Fri, 12 Dec 2025 11:28:29 -0800 Subject: [PATCH] Add test to demonstrate ignoring dialect --- .../__snapshots__/postgres_config_v3.5.0.shot | 100 ++++++++++++++++++ .../fixtures/postgres_config.in/.sqlfluff | 2 + .../fixtures/postgres_config.in/test.sql | 1 + 3 files changed, 103 insertions(+) create mode 100644 qlty-plugins/plugins/linters/sqlfluff/fixtures/__snapshots__/postgres_config_v3.5.0.shot create mode 100644 qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/.sqlfluff create mode 100644 qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/test.sql diff --git a/qlty-plugins/plugins/linters/sqlfluff/fixtures/__snapshots__/postgres_config_v3.5.0.shot b/qlty-plugins/plugins/linters/sqlfluff/fixtures/__snapshots__/postgres_config_v3.5.0.shot new file mode 100644 index 000000000..7c0fe5b9e --- /dev/null +++ b/qlty-plugins/plugins/linters/sqlfluff/fixtures/__snapshots__/postgres_config_v3.5.0.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`linter=sqlfluff fixture=postgres_config version=3.5.0 1`] = ` +{ + "issues": [ + { + "category": "CATEGORY_LINT", + "level": "LEVEL_MEDIUM", + "location": { + "path": "test.sql", + "range": { + "endColumn": 22, + "endLine": 1, + "startColumn": 17, + "startLine": 1, + }, + }, + "message": "Unnecessary quoted identifier "bar".", + "mode": "MODE_BLOCK", + "ruleKey": "RF06", + "snippet": "SELECT "foo" AS "bar";", + "snippetWithContext": "SELECT "foo" AS "bar";", + "suggestions": [ + { + "patch": "--- original ++++ modified +@@ -1 +1 @@ +-SELECT "foo" AS "bar"; ++SELECT "foo" AS bar; +", + "replacements": [ + { + "data": "bar", + "location": { + "path": "test.sql", + "range": { + "endByte": 21, + "endColumn": 22, + "endLine": 1, + "startByte": 16, + "startColumn": 17, + "startLine": 1, + }, + }, + }, + ], + "source": "SUGGESTION_SOURCE_TOOL", + }, + ], + "tool": "sqlfluff", + }, + { + "category": "CATEGORY_LINT", + "level": "LEVEL_MEDIUM", + "location": { + "path": "test.sql", + "range": { + "endColumn": 13, + "endLine": 1, + "startColumn": 8, + "startLine": 1, + }, + }, + "message": "Unnecessary quoted identifier "foo".", + "mode": "MODE_BLOCK", + "ruleKey": "RF06", + "snippet": "SELECT "foo" AS "bar";", + "snippetWithContext": "SELECT "foo" AS "bar";", + "suggestions": [ + { + "patch": "--- original ++++ modified +@@ -1 +1 @@ +-SELECT "foo" AS "bar"; ++SELECT foo AS "bar"; +", + "replacements": [ + { + "data": "foo", + "location": { + "path": "test.sql", + "range": { + "endByte": 12, + "endColumn": 13, + "endLine": 1, + "startByte": 7, + "startColumn": 8, + "startLine": 1, + }, + }, + }, + ], + "source": "SUGGESTION_SOURCE_TOOL", + }, + ], + "tool": "sqlfluff", + }, + ], +} +`; diff --git a/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/.sqlfluff b/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/.sqlfluff new file mode 100644 index 000000000..7fb4ec3d0 --- /dev/null +++ b/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/.sqlfluff @@ -0,0 +1,2 @@ +[sqlfluff] +dialect = postgres diff --git a/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/test.sql b/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/test.sql new file mode 100644 index 000000000..2232114b5 --- /dev/null +++ b/qlty-plugins/plugins/linters/sqlfluff/fixtures/postgres_config.in/test.sql @@ -0,0 +1 @@ +SELECT "foo" AS "bar";