diff --git a/linters/cfnlint/test_data/cfnlint_v1.35.3_basic.check.shot b/linters/cfnlint/test_data/cfnlint_v1.35.1_basic.check.shot similarity index 97% rename from linters/cfnlint/test_data/cfnlint_v1.35.3_basic.check.shot rename to linters/cfnlint/test_data/cfnlint_v1.35.1_basic.check.shot index fd863b5e5..e6de935e3 100644 --- a/linters/cfnlint/test_data/cfnlint_v1.35.3_basic.check.shot +++ b/linters/cfnlint/test_data/cfnlint_v1.35.1_basic.check.shot @@ -1,4 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +// trunk-upgrade-validation:RELEASE exports[`Testing linter cfnlint test basic 1`] = ` { diff --git a/linters/pmd/test_data/pmd_v7.13.0_CUSTOM.check.shot b/linters/pmd/test_data/pmd_v7.13.0_CUSTOM.check.shot new file mode 100644 index 000000000..985d42e2c --- /dev/null +++ b/linters/pmd/test_data/pmd_v7.13.0_CUSTOM.check.shot @@ -0,0 +1,141 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP +// trunk-upgrade-validation:RELEASE + +exports[`Testing linter pmd test CUSTOM 1`] = ` +{ + "issues": [ + { + "code": "ApexDoc", + "column": "8", + "file": "test_data/apex.in.cls", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_MEDIUM", + "line": "1", + "linter": "pmd", + "message": "Missing ApexDoc comment", + "ranges": [ + { + "filePath": "test_data/apex.in.cls", + "length": "69", + "offset": "7", + }, + ], + "targetType": "apex", + }, + { + "code": "AvoidGlobalModifier", + "column": "8", + "file": "test_data/apex.in.cls", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_MEDIUM", + "line": "1", + "linter": "pmd", + "message": "Avoid using global modifier", + "ranges": [ + { + "filePath": "test_data/apex.in.cls", + "length": "69", + "offset": "7", + }, + ], + "targetType": "apex", + }, + { + "code": "ApexDoc", + "column": "8", + "file": "test_data/apex.in.cls", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_MEDIUM", + "line": "2", + "linter": "pmd", + "message": "Missing ApexDoc comment", + "ranges": [ + { + "filePath": "test_data/apex.in.cls", + "length": "41", + "offset": "33", + }, + ], + "targetType": "apex", + }, + { + "code": "NoPackage", + "column": "1", + "file": "test_data/hello.in.java", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_MEDIUM", + "line": "3", + "linter": "pmd", + "message": "All classes, interfaces, enums and annotations must belong to a named package", + "ranges": [ + { + "filePath": "test_data/hello.in.java", + "length": "5", + "offset": "23", + }, + ], + "targetType": "java", + }, + { + "code": "UseUtilityClass", + "column": "1", + "file": "test_data/hello.in.java", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_MEDIUM", + "line": "3", + "linter": "pmd", + "message": "This utility class has a non-private constructor", + "ranges": [ + { + "filePath": "test_data/hello.in.java", + "length": "5", + "offset": "23", + }, + ], + "targetType": "java", + }, + ], + "lintActions": [ + { + "command": "lint-apex", + "fileGroupName": "apex", + "linter": "pmd", + "paths": [ + "test_data/apex.in.cls", + ], + "verb": "TRUNK_VERB_CHECK", + }, + { + "command": "lint-apex", + "fileGroupName": "apex", + "linter": "pmd", + "paths": [ + "test_data/apex.in.cls", + ], + "upstream": true, + "verb": "TRUNK_VERB_CHECK", + }, + { + "command": "lint-java", + "fileGroupName": "java", + "linter": "pmd", + "paths": [ + "test_data/hello.in.java", + ], + "verb": "TRUNK_VERB_CHECK", + }, + { + "command": "lint-java", + "fileGroupName": "java", + "linter": "pmd", + "paths": [ + "test_data/hello.in.java", + ], + "upstream": true, + "verb": "TRUNK_VERB_CHECK", + }, + ], + "taskFailures": [], + "unformattedFiles": [], +} +`; diff --git a/linters/semgrep/plugin.yaml b/linters/semgrep/plugin.yaml index 93e4bcd64..cbb048d68 100644 --- a/linters/semgrep/plugin.yaml +++ b/linters/semgrep/plugin.yaml @@ -34,8 +34,8 @@ lint: environment: - name: PATH list: ["${env.PATH}"] - known_good_version: 1.122.0 - known_bad_versions: [1.5.1, 1.117.0] # Does not work on MacOS + known_good_version: 1.33.2 + known_bad_versions: [1.5.1] # Does not work on MacOS version_command: parse_regex: ${semver} run: semgrep --version diff --git a/linters/semgrep/semgrep.test.ts b/linters/semgrep/semgrep.test.ts index 34fd9accf..7c8e8dbbc 100644 --- a/linters/semgrep/semgrep.test.ts +++ b/linters/semgrep/semgrep.test.ts @@ -1,9 +1,31 @@ import { customLinterCheckTest } from "tests"; +import { type TrunkLintDriver } from "tests/driver"; import { skipOS, TEST_DATA } from "tests/utils"; +// NOTE(Tyler): As of semgrep 1.117.0 the first (and only the first) semgrep run may end up excluding the --include paths +const preCheck = (driver: TrunkLintDriver) => { + const trunkYamlPath = ".trunk/trunk.yaml"; + const currentContents = driver.readFile(trunkYamlPath); + const lintRegex = /\nlint:/; + const newContents = currentContents.replace( + lintRegex, + ` +lint: + definitions: + - name: semgrep + commands: + - name: check + run: semgrep --config=auto --sarif --output=\${tmpfile} --include=* --include=\${target} + +`, + ); + driver.writeFile(trunkYamlPath, newContents); +}; + // Note semgrep runs can take a while since they require downloading rulesets each time. customLinterCheckTest({ linterName: "semgrep", + preCheck, args: `${TEST_DATA} --cache=false`, skipTestIf: skipOS(["win32"]), }); diff --git a/linters/semgrep/test_data/semgrep_v1.122.0_CUSTOM.check.shot b/linters/semgrep/test_data/semgrep_v1.122.0_CUSTOM.check.shot deleted file mode 100644 index 97f28cbbc..000000000 --- a/linters/semgrep/test_data/semgrep_v1.122.0_CUSTOM.check.shot +++ /dev/null @@ -1,125 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing linter semgrep test CUSTOM 1`] = ` -{ - "issues": [], - "lintActions": [ - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/basic.go", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/element.ts", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_go.go", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_js.js", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_py.py", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/request.py", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/basic.go", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/element.ts", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_go.go", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_js.js", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/empty_py.py", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "check", - "fileGroupName": "ALL", - "linter": "semgrep", - "paths": [ - "test_data/request.py", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - ], - "taskFailures": [], - "unformattedFiles": [], -} -`; diff --git a/linters/sourcery/sourcery.test.ts b/linters/sourcery/sourcery.test.ts index 19ac943b7..40bfd3d3d 100644 --- a/linters/sourcery/sourcery.test.ts +++ b/linters/sourcery/sourcery.test.ts @@ -4,7 +4,7 @@ import { customLinterCheckTest } from "tests"; import { TrunkLintDriver } from "tests/driver"; import { REPO_ROOT, skipCPUOS, TEST_DATA } from "tests/utils"; -// // You must login in order to use sourcery +// You must login in order to use sourcery const preCheck = (driver: TrunkLintDriver) => { driver.moveFile(path.join(TEST_DATA, "_plugin.yaml"), path.join(TEST_DATA, "plugin.yaml")); diff --git a/linters/sourcery/test_data/sourcery_v1.2.0_CUSTOM.check.shot b/linters/sourcery/test_data/sourcery_v1.2.0_CUSTOM.check.shot deleted file mode 100644 index efccd7fff..000000000 --- a/linters/sourcery/test_data/sourcery_v1.2.0_CUSTOM.check.shot +++ /dev/null @@ -1,73 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing linter sourcery test CUSTOM 1`] = ` -{ - "issues": [ - { - "code": "raise-specific-error", - "column": "1", - "file": "test_data/basic.in.py", - "issueUrl": "https://docs.sourcery.ai/Reference/Python/Default-Rules/raise-specific-error", - "level": "LEVEL_HIGH", - "line": "10", - "linter": "sourcery", - "message": "Raise a specific error instead of the general Exception", - "targetType": "python", - }, - { - "code": "replace-interpolation-with-fstring", - "column": "1", - "file": "test_data/basic.in.py", - "issueUrl": "https://docs.sourcery.ai/Reference/Python/Default-Rules/replace-interpolation-with-fstring", - "level": "LEVEL_HIGH", - "line": "4", - "linter": "sourcery", - "message": "Replace interpolated string formatting with f-string", - "targetType": "python", - }, - { - "code": "raise-from-previous-error", - "column": "1", - "file": "test_data/basic.in.py", - "issueUrl": "https://docs.sourcery.ai/Reference/Python/Default-Rules/raise-from-previous-error", - "level": "LEVEL_HIGH", - "line": "7", - "linter": "sourcery", - "message": "Explicitly raise from a previous error", - "targetType": "python", - }, - ], - "lintActions": [ - { - "command": "fix", - "fileGroupName": "python", - "linter": "sourcery", - "paths": [ - "test_data/basic.in.py", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "lint", - "fileGroupName": "python", - "linter": "sourcery", - "paths": [ - "test_data/basic.in.py", - ], - "verb": "TRUNK_VERB_CHECK", - }, - ], - "taskFailures": [], - "unformattedFiles": [ - { - "column": "1", - "file": "test_data/basic.in.py", - "issueClass": "ISSUE_CLASS_UNFORMATTED", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sourcery", - "message": "Incorrect formatting, autoformat by running 'trunk fmt'", - }, - ], -} -`; diff --git a/linters/sourcery/test_data/sourcery_v1.10.1_CUSTOM.check.shot b/linters/sourcery/test_data/sourcery_v1.37.0_CUSTOM.check.shot similarity index 100% rename from linters/sourcery/test_data/sourcery_v1.10.1_CUSTOM.check.shot rename to linters/sourcery/test_data/sourcery_v1.37.0_CUSTOM.check.shot diff --git a/linters/sqlfluff/plugin.yaml b/linters/sqlfluff/plugin.yaml index 8f2c51836..c52121a91 100644 --- a/linters/sqlfluff/plugin.yaml +++ b/linters/sqlfluff/plugin.yaml @@ -5,14 +5,14 @@ tools: runtime: python package: sqlfluff shims: [sqlfluff] - known_good_version: 3.4.0 + known_good_version: 3.0.0 lint: definitions: - name: sqlfluff files: [sql, sql-j2, dml, ddl] tools: [sqlfluff] description: A dialect-flexible and configurable SQL linter - known_good_version: 3.4.0 + known_good_version: 3.0.0 direct_configs: - .sqlfluff affects_cache: diff --git a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.check.shot b/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.check.shot deleted file mode 100644 index 9eb06a2ba..000000000 --- a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.check.shot +++ /dev/null @@ -1,163 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing linter sqlfluff test basic_check 1`] = ` -{ - "issues": [ - { - "code": "L010", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L036", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Select targets should be on a new line unless there is only one select target.", - "targetType": "sql", - }, - { - "code": "L044", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Query produces an unknown number of result columns.", - "targetType": "sql", - }, - { - "code": "L013", - "column": "12", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Column expression without alias. Use explicit \`AS\` clause.", - "targetType": "sql", - }, - { - "code": "L010", - "column": "20", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "22", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unnecessary whitespace found.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "24", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "27", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unnecessary whitespace found.", - "targetType": "sql", - }, - { - "code": "L010", - "column": "29", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "34", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "43", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "7", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unnecessary whitespace found.", - "targetType": "sql", - }, - ], - "lintActions": [ - { - "command": "lint", - "fileGroupName": "sql", - "linter": "sqlfluff", - "paths": [ - "test_data/basic_check.in.sql", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "lint", - "fileGroupName": "sql", - "linter": "sqlfluff", - "paths": [ - "test_data/basic_check.in.sql", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - ], - "taskFailures": [], - "unformattedFiles": [], -} -`; diff --git a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.fmt.shot b/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.fmt.shot deleted file mode 100644 index 0932f952c..000000000 --- a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_check.fmt.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing formatter sqlfluff test basic_check 1`] = ` -"SELECT - *, - 1, - blah AS foo -FROM myschema.mytable -" -`; diff --git a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_fmt.fmt.shot b/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_fmt.fmt.shot deleted file mode 100644 index c29cb0da2..000000000 --- a/linters/sqlfluff/test_data/sqlfluff_v1.4.2_basic_fmt.fmt.shot +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing formatter sqlfluff test basic_fmt 1`] = ` -"SELECT - col_a, - col_b, - COUNT(*) AS num, - SUM(num) OVER ( - PARTITION BY col_a - ORDER BY col_b - ) AS an_aggregate_function -FROM tbl_a -GROUP BY 1, 2 -" -`; diff --git a/linters/sqlfluff/test_data/sqlfluff_v1.4.4_basic_check.check.shot b/linters/sqlfluff/test_data/sqlfluff_v1.4.4_basic_check.check.shot deleted file mode 100644 index fe4a9190b..000000000 --- a/linters/sqlfluff/test_data/sqlfluff_v1.4.4_basic_check.check.shot +++ /dev/null @@ -1,163 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Testing linter sqlfluff test basic_check 1`] = ` -{ - "issues": [ - { - "code": "L010", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L036", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Select targets should be on a new line unless there is only one select target.", - "targetType": "sql", - }, - { - "code": "L044", - "column": "1", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Query produces an unknown number of result columns.", - "targetType": "sql", - }, - { - "code": "L013", - "column": "12", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Column expression without alias. Use explicit \`AS\` clause.", - "targetType": "sql", - }, - { - "code": "L010", - "column": "20", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "22", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Expected only single space before naked identifier. Found ' '.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "24", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "27", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Expected only single space before 'from' keyword. Found ' '.", - "targetType": "sql", - }, - { - "code": "L010", - "column": "29", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Keywords must be consistently upper case.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "34", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L014", - "column": "43", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Unquoted identifiers must be consistently lower case.", - "targetType": "sql", - }, - { - "code": "L039", - "column": "7", - "file": "test_data/basic_check.in.sql", - "issueClass": "ISSUE_CLASS_EXISTING", - "level": "LEVEL_HIGH", - "line": "1", - "linter": "sqlfluff", - "message": "Expected only single space before star '*'. Found ' '.", - "targetType": "sql", - }, - ], - "lintActions": [ - { - "command": "lint", - "fileGroupName": "sql", - "linter": "sqlfluff", - "paths": [ - "test_data/basic_check.in.sql", - ], - "verb": "TRUNK_VERB_CHECK", - }, - { - "command": "lint", - "fileGroupName": "sql", - "linter": "sqlfluff", - "paths": [ - "test_data/basic_check.in.sql", - ], - "upstream": true, - "verb": "TRUNK_VERB_CHECK", - }, - ], - "taskFailures": [], - "unformattedFiles": [], -} -`; diff --git a/linters/squawk/test_data/squawk_v2.4.0_basic.check.shot b/linters/squawk/test_data/squawk_v2.4.0_basic.check.shot new file mode 100644 index 000000000..875ab175c --- /dev/null +++ b/linters/squawk/test_data/squawk_v2.4.0_basic.check.shot @@ -0,0 +1,127 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP +// trunk-upgrade-validation:RELEASE + +exports[`Testing linter squawk test basic 1`] = ` +{ + "issues": [ + { + "code": "prefer-robust-stmts", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "linter": "squawk", + "message": "Missing \`IF NOT EXISTS\`, the migration can't be rerun if it fails part way through.", + "targetType": "sql", + }, + { + "code": "prefer-bigint-over-int", + "column": "7", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "1", + "linter": "squawk", + "message": "Using 32-bit integer fields can result in hitting the max \`int\` limit.", + "targetType": "sql", + }, + { + "code": "prefer-identity", + "column": "7", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "1", + "linter": "squawk", + "message": "Serial types make schema, dependency, and permission management difficult.", + "targetType": "sql", + }, + { + "code": "prefer-text-field", + "column": "10", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "2", + "linter": "squawk", + "message": "Changing the size of a \`varchar\` field requires an \`ACCESS EXCLUSIVE\` lock, that will prevent all reads and writes to the table.", + "targetType": "sql", + }, + { + "code": "prefer-robust-stmts", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "5", + "linter": "squawk", + "message": "Missing \`IF NOT EXISTS\`, the migration can't be rerun if it fails part way through.", + "targetType": "sql", + }, + { + "code": "require-concurrent-index-creation", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "5", + "linter": "squawk", + "message": "During normal index creation, table updates are blocked, but reads are still allowed.", + "targetType": "sql", + }, + { + "code": "constraint-missing-not-valid", + "column": "23", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "7", + "linter": "squawk", + "message": "By default new constraints require a table scan and block writes to the table while that scan occurs.", + "targetType": "sql", + }, + { + "code": "prefer-robust-stmts", + "column": "23", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "7", + "linter": "squawk", + "message": "Missing transaction, the migration can't be rerun if it fails part way through.", + "targetType": "sql", + }, + { + "code": "disallowed-unique-constraint", + "column": "27", + "file": "test_data/basic.in.sql", + "issueClass": "ISSUE_CLASS_EXISTING", + "level": "LEVEL_HIGH", + "line": "7", + "linter": "squawk", + "message": "Adding a \`UNIQUE\` constraint requires an \`ACCESS EXCLUSIVE\` lock which blocks reads and writes to the table while the index is built.", + "targetType": "sql", + }, + ], + "lintActions": [ + { + "command": "lint", + "fileGroupName": "sql", + "linter": "squawk", + "paths": [ + "test_data/basic.in.sql", + ], + "verb": "TRUNK_VERB_CHECK", + }, + { + "command": "lint", + "fileGroupName": "sql", + "linter": "squawk", + "paths": [ + "test_data/basic.in.sql", + ], + "upstream": true, + "verb": "TRUNK_VERB_CHECK", + }, + ], + "taskFailures": [], + "unformattedFiles": [], +} +`; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy