Skip to content

Commit a6cfd96

Browse files
authored
Introduce yaml linter (#362)
Add yamllint and update the yml files accordingly.
1 parent 526c8aa commit a6cfd96

File tree

13 files changed

+102
-50
lines changed

13 files changed

+102
-50
lines changed

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ max_line_length = 100
1111
[Makefile]
1212
indent_style = tab
1313

14-
[scripts/*, *.sh]
14+
[{scripts/*, *.sh}]
1515
max_line_length = 80
1616
indent_style = space
1717
indent_size = 2
@@ -20,3 +20,7 @@ binary_next_line = true
2020
switch_case_indent = true
2121
space_redirects = true
2222
keep_padding = true
23+
24+
[*.{yaml,yml}]
25+
indent_style = space
26+
indent_size = 2

.github/dependabot.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# To get started with Dependabot version updates, you'll need to specify which
23
# package ecosystems to update and where the package manifests are located.
34
# Please see the documentation for all configuration options:
@@ -6,10 +7,10 @@
67
version: 2
78
updates:
89
- package-ecosystem: gomod
9-
directory: "/"
10+
directory: /
1011
schedule:
1112
interval: weekly
1213
- package-ecosystem: github-actions
13-
directory: "/"
14+
directory: /
1415
schedule:
1516
interval: weekly

.github/probots.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
---
2+
13
enabled:
24
- cla

.github/workflows/analysis.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
name: Analysis
24

35
on:
@@ -6,32 +8,33 @@ on:
68
pull_request:
79
branches: [ master ]
810
schedule:
9-
- cron: '13 7 * * 6'
11+
- cron: 13 7 * * 6
1012

1113
jobs:
1214
linting:
1315
runs-on: ubuntu-latest
1416

1517
steps:
16-
-
17-
name: checkout
18+
- name: checkout
1819
uses: actions/checkout@v2
1920
with:
2021
fetch-depth: 0
2122

22-
-
23-
name: golangci-lint
23+
- name: golangci-lint
2424
uses: golangci/golangci-lint-action@5c56cd6c9dc07901af25baab6f2b0d9f3b7c3018
2525
with:
26-
version: v1.42.1
26+
version: v1.43.0
2727

28-
-
29-
name: shellcheck
28+
- name: shellcheck
3029
uses: azohra/shell-linter@6bbeaa868df09c34ddc008e6030cfe89c03394a1
3130
with:
32-
path: scripts/*
31+
path: scripts/test-*
3332
severity: error
3433

34+
- name: yaml-lint
35+
uses: ibiqlik/action-yamllint@v3
36+
with:
37+
config_file: .yamllint.yml
3538

3639
vulnerabilities:
3740
runs-on: ubuntu-latest
@@ -40,18 +43,15 @@ jobs:
4043
security-events: write
4144

4245
steps:
43-
-
44-
name: checkout
46+
- name: checkout
4547
uses: actions/checkout@v2
4648
with:
4749
fetch-depth: 0
4850

49-
-
50-
name: initialize
51+
- name: initialize
5152
uses: github/codeql-action/init@v1
5253
with:
5354
languages: go
5455

55-
-
56-
name: codeql analyze
56+
- name: codeql analyze
5757
uses: github/codeql-action/analyze@v1

.github/workflows/release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
---
2+
13
name: Release
24

35
on:
46
push:
5-
tags: [ 'v*.*.*' ]
7+
tags: [ v*.*.* ]
68

79
env:
810
REGISTRY: ghcr.io
@@ -34,7 +36,8 @@ jobs:
3436
-
3537
name: Verify tag signature
3638
run: |
37-
# NOTE: Solve the problem with Github action checkout https://github.com/actions/checkout/issues/290
39+
# NOTE: Solve the problem with Github action checkout
40+
# https://github.com/actions/checkout/issues/290
3841
git fetch --tags --force
3942
4043
version=${GITHUB_REF#refs/tags/*}

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
name: Test
24

35
on:

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
linters:
24
disable-all: true
35
enable:

.goreleaser.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
project_name: toxiproxy
24

35
env:
@@ -33,6 +35,7 @@ builds:
3335
ignore:
3436
- goos: windows
3537
goarch: arm64
38+
3639
- goarch: arm
3740

3841
ldflags:
@@ -43,15 +46,15 @@ builds:
4346
goarch:
4447
- arm
4548
goarm:
46-
- 6
47-
- 7
49+
- "6"
50+
- "7"
4851
ignore:
4952
- goos: windows
5053
goarch: arm
5154
binary: toxiproxy-server-{{.Os}}-{{.Arch}}v{{.Arm}}
5255

5356
- &build_client
54-
<<: *build_default
57+
<<: *build_default
5558
id: client
5659
main: ./cmd/cli
5760
binary: toxiproxy-cli-{{.Os}}-{{.Arch}}
@@ -61,8 +64,8 @@ builds:
6164
goarch:
6265
- arm
6366
goarm:
64-
- 6
65-
- 7
67+
- "6"
68+
- "7"
6669
ignore:
6770
- goos: windows
6871
goarch: arm
@@ -86,8 +89,7 @@ snapshot:
8689
name_template: "{{ incpatch .Version }}-next"
8790

8891
nfpms:
89-
-
90-
id: packages
92+
- id: packages
9193
package_name: toxiproxy
9294
homepage: https://github.com/Shopify/toxiproxy
9395
maintainer: Shopify Opensource <opensource@shopify.com>
@@ -101,10 +103,10 @@ nfpms:
101103
- apk
102104
- deb
103105
- rpm
104-
# NOTE: Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd.
105-
# contents:
106-
# - src: share/toxiproxy.conf
107-
# dst: /etc/init/toxiproxy.conf
106+
# NOTE: Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd.
107+
# contents:
108+
# - src: share/toxiproxy.conf
109+
# dst: /etc/init/toxiproxy.conf
108110

109111
dockers:
110112
- &docker
@@ -149,7 +151,7 @@ dockers:
149151
- --label=org.opencontainers.image.licenses=MIT
150152
- <<: *docker
151153
goarch: arm
152-
goarm: 7
154+
goarm: "7"
153155
image_templates:
154156
- ghcr.io/shopify/toxiproxy:{{ .Version }}-armv7
155157
- ghcr.io/shopify/toxiproxy:v{{ .Major }}-armv7
@@ -167,7 +169,7 @@ dockers:
167169
- --label=org.opencontainers.image.licenses=MIT
168170
- <<: *docker
169171
goarch: arm
170-
goarm: 6
172+
goarm: "6"
171173
image_templates:
172174
- ghcr.io/shopify/toxiproxy:{{ .Version }}-armv6
173175
- ghcr.io/shopify/toxiproxy:v{{ .Major }}-armv6
@@ -185,15 +187,13 @@ dockers:
185187
- --label=org.opencontainers.image.licenses=MIT
186188

187189
docker_manifests:
188-
-
189-
name_template: ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}
190+
- name_template: ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}
190191
image_templates:
191192
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-amd64
192193
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-arm64
193194
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-armv6
194195
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-armv7
195-
-
196-
name_template: ghcr.io/shopify/{{ .ProjectName }}:latest
196+
- name_template: ghcr.io/shopify/{{ .ProjectName }}:latest
197197
image_templates:
198198
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-amd64
199199
- ghcr.io/shopify/{{ .ProjectName }}:{{ .Version }}-arm64
@@ -204,20 +204,19 @@ changelog:
204204
sort: asc
205205
filters:
206206
exclude:
207-
- '^docs:'
208-
- '^test:'
209-
- '^Merge'
207+
- "^docs:"
208+
- "^test:"
209+
- ^Merge
210210

211211
archives:
212-
-
213-
id: archive_binaries
212+
- id: archive_binaries
214213
format: binary
215214
name_template: "{{ .Binary }}"
216215
builds:
217216
- server
218217
- client
219-
-
220-
id: archive_default
218+
219+
- id: archive_default
221220
format: tar.gz
222221
builds:
223222
- pkg-server

.yamllint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
3+
yaml-files:
4+
- "*.yaml"
5+
- "*.yml"
6+
7+
ignore: |
8+
vendor/**/*
9+
dist/*.yaml
10+
11+
rules:
12+
comments:
13+
require-starting-space: true
14+
comments-indentation: enable
15+
document-start:
16+
present: true
17+
indentation:
18+
spaces: 2
19+
indent-sequences: true
20+
check-multi-line-strings: true
21+
line-length:
22+
max: 100
23+
level: warning
24+
allow-non-breakable-words: true
25+
allow-non-breakable-inline-mappings: false
26+
key-duplicates: enable
27+
new-lines:
28+
type: unix
29+
trailing-spaces: enable
30+
quoted-strings:
31+
quote-type: double
32+
required: only-when-needed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Rename `testing/` and `bin/` folders (#354, @strech)
66
* Added verbose error on proxy upstream dialing (#355, @f-dg)
77
* Improve server startup message (#358, @areveny)
8+
* Introduce yaml linter. (#362, @miry)
89

910
# [2.3.0] - 2021-12-23
1011

0 commit comments

Comments
 (0)