Skip to content

Commit

Permalink
Update definition for trunk-toolbox to include latest support for nev…
Browse files Browse the repository at this point in the history
…eredit rule (#859)

1. trunk toolbox definition and support changes with version 0.4.1.
toolbox can now run correctly with hold-the-line standard upstream
support. Also adds support for a new rule "neveredit" which protect
files from editing once checked in.
2. backwards support for old version of toolbox is maintained.
  • Loading branch information
EliSchleifer authored Sep 3, 2024
1 parent 4edf931 commit 2c48cf4
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 4 deletions.
1 change: 1 addition & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ lint:
# enabled linters inherited from github.com/trunk-io/configs plugin
- definition-checker
- [email protected]
- [email protected]
disabled:
- pylint # pylint diagnostics are too strict
- semgrep
Expand Down
17 changes: 13 additions & 4 deletions linters/trunk-toolbox/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.1

downloads:
- name: trunk-toolbox
version: 0.3.1
version: 0.4.1
downloads:
- os:
linux: unknown-linux-gnu
Expand All @@ -17,21 +17,30 @@ tools:
- name: trunk-toolbox
download: trunk-toolbox
shims: [trunk-toolbox]
known_good_version: 0.3.1
known_good_version: 0.4.1
lint:
definitions:
- name: trunk-toolbox
description: Repository level linting tools
main_tool: trunk-toolbox
files: [ALL]
description: Collection of universal linting tools
commands:
- name: lint
run: trunk-toolbox --upstream=${upstream-ref} --results=${tmpfile} ${target}
version: ">=0.4.1"
run:
trunk-toolbox --upstream=${upstream-ref} --cache-dir=${cachedir} --results=${tmpfile}
${target}
output: sarif
batch: true
success_codes: [0]
read_output_from: tmp_file
- name: lint
run: trunk-toolbox --upstream=${upstream-ref} --results=${tmpfile} ${target}
output: sarif
batch: true
success_codes: [0]
disable_upstream: true
read_output_from: tmp_file
suggest_if: never
version_command:
parse_regex: ${semver}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing linter trunk-toolbox test do_not_land 1`] = `
{
"issues": [
{
"code": "do-not-land",
"column": "3",
"file": "test_data/do_not_land.in.txt",
"issueClass": "ISSUE_CLASS_NEW",
"level": "LEVEL_HIGH",
"line": "1",
"linter": "trunk-toolbox",
"message": "Found 'DONOTLAND'",
"ranges": [
{
"filePath": "test_data/do_not_land.in.txt",
"length": "9",
"offset": "2",
},
],
"targetType": "ALL",
},
{
"code": "do-not-land",
"column": "3",
"file": "test_data/do_not_land.in.txt",
"issueClass": "ISSUE_CLASS_NEW",
"level": "LEVEL_HIGH",
"line": "2",
"linter": "trunk-toolbox",
"message": "Found 'do-not-land'",
"ranges": [
{
"filePath": "test_data/do_not_land.in.txt",
"length": "11",
"offset": "14",
},
],
"targetType": "ALL",
},
{
"code": "do-not-land",
"column": "3",
"file": "test_data/do_not_land.in.txt",
"issueClass": "ISSUE_CLASS_NEW",
"level": "LEVEL_HIGH",
"line": "3",
"linter": "trunk-toolbox",
"message": "Found 'do_not_land'",
"ranges": [
{
"filePath": "test_data/do_not_land.in.txt",
"length": "11",
"offset": "28",
},
],
"targetType": "ALL",
},
],
"lintActions": [
{
"command": "lint",
"fileGroupName": "ALL",
"linter": "trunk-toolbox",
"paths": [
"test_data/do_not_land.in.txt",
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "ALL",
"linter": "trunk-toolbox",
"paths": [
"test_data/do_not_land.in.txt",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
}
`;

0 comments on commit 2c48cf4

Please sign in to comment.