Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 23b5705

Browse files
authored
Merge pull request #407 from dapirian/enable_trunk
Enable trunk superlinter
2 parents 7ccbac6 + 4b0cd9c commit 23b5705

File tree

10 files changed

+141
-0
lines changed

10 files changed

+141
-0
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2

.trunk/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*out
2+
*logs
3+
*actions
4+
*notifications
5+
plugins
6+
user_trunk.yaml
7+
user.yaml

.trunk/config/.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Autoformatter friendly flake8 config (all formatting rules disabled)
2+
[flake8]
3+
extend-ignore = D1, D2, E1, E2, E3, E501, W1, W2, W3, W5

.trunk/config/.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
profile=black

.trunk/config/.markdownlint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Autoformatter friendly markdownlint config (all formatting rules disabled)
2+
default: true
3+
blank_lines: false
4+
bullet: false
5+
html: false
6+
indentation: false
7+
line_length: false
8+
spaces: false
9+
url: false
10+
whitespace: false

.trunk/config/.shellcheckrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enable=all
2+
source-path=SCRIPTDIR

.trunk/config/rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
edition = "2021"

.trunk/config/svgo.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
plugins: [
3+
{
4+
name: "preset-default",
5+
params: {
6+
overrides: {
7+
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
8+
sortAttrs: true,
9+
removeOffCanvasPaths: true,
10+
},
11+
},
12+
},
13+
],
14+
};

.trunk/trunk.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
version: 0.1
2+
cli:
3+
version: 1.0.1
4+
plugins:
5+
sources:
6+
# The official Trunk.io repo where new linters are integrated
7+
- id: trunk
8+
ref: v0.0.6
9+
uri: https://github.com/trunk-io/plugins
10+
runtimes:
11+
enabled:
12+
- go@1.19.3
13+
- node@16.14.2
14+
- python@3.10.3
15+
lint:
16+
enabled:
17+
- actionlint@1.6.22
18+
- black@22.10.0
19+
- buf-format@1.9.0
20+
- buf-lint@1.9.0
21+
- check-go-mod
22+
- clippy@1.65.0
23+
- flake8@5.0.4
24+
- git-diff-check
25+
- gitleaks@8.15.0
26+
- gofmt@1.19.3
27+
- golangci-lint@1.50.1
28+
- goreleaser-check@1.12.3
29+
- hadolint@2.10.0
30+
- isort@5.10.1
31+
- markdownlint@0.32.2
32+
- prettier@2.7.1
33+
- rustfmt@1.65.0
34+
- shellcheck@0.8.0
35+
- shfmt@3.5.0
36+
- svgo@3.0.0
37+
- taplo@0.7.0
38+
definitions:
39+
- name: check-go-mod
40+
commands:
41+
- name: lint
42+
output: pass_fail
43+
run: bash -c "git --no-pager diff --exit-code --quiet -- go.sum go.mod vendor/ || { echo \"There are unstaged changes in go vendoring, run 'make go/mod'\"; exit 1; }"
44+
success_codes: [0, 1]
45+
cache_results: false
46+
disable_upstream: true
47+
hold_the_line: false
48+
environment:
49+
- name: PATH
50+
list: ["${env.PATH}"]
51+
- name: goreleaser-check
52+
commands:
53+
- name: lint
54+
output: pass_fail
55+
run: goreleaser check -f ${target}
56+
success_codes: [0, 1]
57+
read_output_from: stderr
58+
environment:
59+
- name: PATH
60+
list: ["${env.PATH}"]
61+
runtime: go
62+
package: github.com/goreleaser/goreleaser
63+
version_command:
64+
parse_regex: goreleaser version ${semver} .*
65+
run: goreleaser --version
66+
triggers:
67+
- linters: [check-go-mod]
68+
targets: [go.mod]
69+
paths: [go.mod, go.sum, vendor/**]
70+
- linters: [goreleaser-check]
71+
targets: [.goreleaser.yaml]
72+
paths: [.goreleaser.yaml]
73+
ignore:
74+
- linters: [ALL]
75+
paths: ["**/vendor/**"]
76+
- linters: [prettier]
77+
paths: [operations/phlare/helm/phlare/templates]
78+
actions:
79+
enabled:
80+
- trunk-upgrade-available
81+
# Recommended githooks actions, to turn on later:
82+
# - trunk-announce
83+
# - trunk-check-pre-push
84+
# - trunk-fmt-pre-commit

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ $(BIN)/goreleaser: Makefile go.mod
274274
@mkdir -p $(@D)
275275
GOBIN=$(abspath $(@D)) $(GO) install github.com/goreleaser/goreleaser@v1.11.5
276276

277+
$(BIN)/trunk: Makefile
278+
@mkdir -p $(@D)
279+
curl -L https://trunk.io/releases/trunk -o $(@D)/trunk
280+
chmod +x $(@D)/trunk
281+
277282
KIND_CLUSTER = phlare-dev
278283

279284
.PHONY: helm/lint
@@ -284,6 +289,14 @@ helm/lint: $(BIN)/helm
284289
goreleaser/lint: $(BIN)/goreleaser
285290
$(BIN)/goreleaser check
286291

292+
.PHONY: trunk/lint
293+
trunk/lint: $(BIN)/trunk
294+
$(BIN)/trunk check
295+
296+
.PHONY: trunk/fmt
297+
trunk/fmt: $(BIN)/trunk
298+
$(BIN)/trunk fmt
299+
287300
.PHONY: helm/check
288301
helm/check: $(BIN)/kubeval $(BIN)/helm
289302
$(BIN)/helm repo add --force-update minio https://charts.min.io/

0 commit comments

Comments
 (0)