Skip to content

Commit

Permalink
Merge branch 'main' into tyler/fix-iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJang27 authored Jan 8, 2024
2 parents b7bb244 + 413b205 commit 4db77dd
Show file tree
Hide file tree
Showing 134 changed files with 2,348 additions and 1,249 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ updates:
# trunk-ignore(yamllint/quoted-strings)
time: "08:00" # UTC
labels: [🤖 dependabot]
groups:
dependencies:
patterns:
- "*"
open-pull-requests-limit: 2

- package-ecosystem: npm
Expand Down
5 changes: 3 additions & 2 deletions linters/actionlint/actionlint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { TrunkLintDriver } from "tests/driver";
import { TEST_DATA } from "tests/utils";

// actionlint is specially triggered to run on github workflow files
const preCheck = (driver: TrunkLintDriver) => {
const preCheck = async (driver: TrunkLintDriver) => {
// trunk-ignore-begin(semgrep): driver.getSandbox() is generated during testing and is safe
fs.readdirSync(path.resolve(driver.getSandbox(), TEST_DATA)).forEach((file) => {
driver.moveFile(path.join(TEST_DATA, file), path.join(".github/workflows", file));
});
// trunk-ignore-end(semgrep)
await driver.gitDriver?.add(".").commit("moved");
};

customLinterCheckTest({ linterName: "actionlint", preCheck });
customLinterCheckTest({ linterName: "actionlint", args: ".github", preCheck });
26 changes: 23 additions & 3 deletions linters/actionlint/test_data/actionlint_v1.6.21_CUSTOM.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -19,7 +19,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "6",
Expand All @@ -31,7 +31,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "syntax-check",
"column": "1",
"file": ".github/workflows/empty.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "1",
Expand Down Expand Up @@ -59,6 +59,26 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/bad.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/empty.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
26 changes: 23 additions & 3 deletions linters/actionlint/test_data/actionlint_v1.6.26_CUSTOM.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -19,7 +19,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "6",
Expand All @@ -31,7 +31,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "syntax-check",
"column": "1",
"file": ".github/workflows/empty.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "1",
Expand Down Expand Up @@ -59,6 +59,26 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/bad.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/empty.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
26 changes: 23 additions & 3 deletions linters/actionlint/test_data/actionlint_v1.6.9_CUSTOM.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -19,7 +19,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
"code": "events",
"column": "13",
"file": ".github/workflows/bad.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"line": "6",
Expand All @@ -30,7 +30,7 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
{
"code": "syntax-check",
"file": ".github/workflows/empty.in.yaml",
"issueClass": "ISSUE_CLASS_NEW",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/rhysd/actionlint/blob/main/docs/checks.md",
"level": "LEVEL_HIGH",
"linter": "actionlint",
Expand All @@ -57,6 +57,26 @@ exports[`Testing linter actionlint test CUSTOM 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/bad.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "github-workflow",
"linter": "actionlint",
"paths": [
".github/workflows/empty.in.yaml",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
12 changes: 12 additions & 0 deletions linters/bandit/test_data/bandit_v1.7.3_basic.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Testing linter bandit test basic 1`] = `
"code": "B403",
"file": "test_data/basic.in.py",
"isSecurity": true,
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://pypi.org/project/bandit/",
"level": "LEVEL_LOW",
"line": "1",
Expand All @@ -18,6 +19,7 @@ exports[`Testing linter bandit test basic 1`] = `
"code": "B301",
"file": "test_data/basic.in.py",
"isSecurity": true,
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://pypi.org/project/bandit/",
"level": "LEVEL_MEDIUM",
"line": "6",
Expand All @@ -36,6 +38,16 @@ exports[`Testing linter bandit test basic 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "python",
"linter": "bandit",
"paths": [
"test_data/basic.in.py",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
11 changes: 11 additions & 0 deletions linters/biome/test_data/biome_v1.4.1_basic_check.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Testing linter biome test basic_check 1`] = `
"code": "lint/style/useEnumInitializers",
"column": "6",
"file": "test_data/basic_check.in.ts",
"issueClass": "ISSUE_CLASS_EXISTING",
"level": "LEVEL_HIGH",
"line": "4",
"linter": "biome",
Expand All @@ -33,6 +34,16 @@ exports[`Testing linter biome test basic_check 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "typescript",
"linter": "biome",
"paths": [
"test_data/basic_check.in.ts",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [
Expand Down
15 changes: 15 additions & 0 deletions linters/buf/test_data/buf_lint_v1.1.0_buf_lint.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
{
"code": "FILE_LOWER_SNAKE_CASE",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#file_lower_snake_case",
"level": "LEVEL_HIGH",
"linter": "buf-lint",
Expand All @@ -16,6 +17,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "PACKAGE_DIRECTORY_MATCH",
"column": "1",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#package_directory_match",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -27,6 +29,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "PACKAGE_VERSION_SUFFIX",
"column": "1",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#package_version_suffix",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -38,6 +41,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "ENUM_VALUE_PREFIX",
"column": "3",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#enum_value_prefix",
"level": "LEVEL_HIGH",
"line": "7",
Expand All @@ -49,6 +53,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "ENUM_VALUE_UPPER_SNAKE_CASE",
"column": "3",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#enum_value_upper_snake_case",
"level": "LEVEL_HIGH",
"line": "7",
Expand All @@ -67,6 +72,16 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "proto",
"linter": "buf-lint",
"paths": [
"test_data/buf_lint.in.proto",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
15 changes: 15 additions & 0 deletions linters/buf/test_data/buf_lint_v1.17.0_buf_lint.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "FILE_LOWER_SNAKE_CASE",
"column": "1",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#file_lower_snake_case",
"level": "LEVEL_HIGH",
"line": "1",
Expand All @@ -18,6 +19,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "PACKAGE_DIRECTORY_MATCH",
"column": "1",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#package_directory_match",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -29,6 +31,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "PACKAGE_VERSION_SUFFIX",
"column": "1",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#package_version_suffix",
"level": "LEVEL_HIGH",
"line": "4",
Expand All @@ -40,6 +43,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "ENUM_VALUE_PREFIX",
"column": "3",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#enum_value_prefix",
"level": "LEVEL_HIGH",
"line": "7",
Expand All @@ -51,6 +55,7 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
"code": "ENUM_VALUE_UPPER_SNAKE_CASE",
"column": "3",
"file": "test_data/buf_lint.in.proto",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://docs.buf.build/lint/rules#enum_value_upper_snake_case",
"level": "LEVEL_HIGH",
"line": "7",
Expand All @@ -69,6 +74,16 @@ exports[`Testing linter buf-lint test buf_lint 1`] = `
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "proto",
"linter": "buf-lint",
"paths": [
"test_data/buf_lint.in.proto",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
Expand Down
6 changes: 3 additions & 3 deletions linters/buildifier/buildifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ const writeConfigs = (driver: TrunkLintDriver) => {
// TODO(Tyler): We will eventually need to add a couple more test cases involving failure modes.
customLinterCheckTest({
linterName: "buildifier",
args: "-a",
args: TEST_DATA,
testName: "basic_check",
});

customLinterFmtTest({
linterName: "buildifier",
args: "-a",
args: TEST_DATA,
testName: "no_config",
pathsToSnapshot: [path.join(TEST_DATA, "basic.bzl"), path.join(TEST_DATA, "add_tables.BUILD")],
});
customLinterFmtTest({
linterName: "buildifier",
args: "-a",
args: TEST_DATA,
testName: "with_config",
pathsToSnapshot: [path.join(TEST_DATA, "add_tables.BUILD")],
preCheck: writeConfigs,
Expand Down

This file was deleted.

Loading

0 comments on commit 4db77dd

Please sign in to comment.