Skip to content

Commit 130beb1

Browse files
authored
YAML linter (googleforgames#3358)
Adds a YAML linter to CI, using https://yamllint.readthedocs.io/
1 parent 61056b0 commit 130beb1

File tree

85 files changed

+1252
-1371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1252
-1371
lines changed

.github/release.yml

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Copyright 2023 Google LLC
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,27 +12,17 @@
1112
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1213
# See the License for the specific language governing permissions and
1314
# limitations under the License.
14-
1515
changelog:
1616
exclude:
17-
labels:
18-
- duplicate
19-
- question
20-
- invalid
21-
- wontfix
17+
labels: [duplicate, question, invalid, wontfix]
2218
categories:
2319
- title: Breaking changes
24-
labels:
25-
- kind/breaking
20+
labels: [kind/breaking]
2621
- title: Implemented enhancements
27-
labels:
28-
- kind/feature
22+
labels: [kind/feature]
2923
- title: Fixed bugs
30-
labels:
31-
- kind/bug
24+
labels: [kind/bug]
3225
- title: Security fixes
33-
labels:
34-
- area/security
26+
labels: [area/security]
3527
- title: Other
36-
labels:
37-
- "*"
28+
labels: ['*']

.github/workflows/close.yaml

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Copyright 2023 Google LLC
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,31 +19,27 @@
1819
# For more information, see:
1920
# https://github.com/actions/stale
2021
name: Close Old
21-
2222
on:
2323
workflow_dispatch:
2424
schedule:
25-
- cron: '0 1 1,15 * *'
26-
25+
- cron: 0 1 1,15 * *
2726
jobs:
2827
stale:
29-
3028
runs-on: ubuntu-latest
3129
permissions:
3230
issues: write
33-
34-
3531
steps:
36-
- uses: actions/stale@v5
37-
with:
38-
repo-token: ${{ secrets.GITHUB_TOKEN }}
39-
days-before-issue-stale: 30
40-
close-issue-message: >
41-
We are closing this as there was no activity in this issue for last 90 days. Please reopen if you’d like to discuss anything further.
42-
only-labels: 'obsolete'
43-
exempt-issue-labels: awaiting-maintainer
44-
ascending: true
45-
days-before-close: 0
46-
close-issue-reason: "not_planned"
47-
stale-issue-label: 'wontfix'
48-
enable-statistics: true
32+
- uses: actions/stale@v5
33+
with:
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
days-before-issue-stale: 30
36+
close-issue-message: >
37+
We are closing this as there was no activity in this issue for last 90
38+
days. Please reopen if you’d like to discuss anything further.
39+
only-labels: obsolete
40+
exempt-issue-labels: awaiting-maintainer
41+
ascending: true
42+
days-before-close: 0
43+
close-issue-reason: not_planned
44+
stale-issue-label: wontfix
45+
enable-statistics: true

.github/workflows/label-pr.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Copyright 2023 Google LLC
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +15,8 @@
1415
#
1516
# This workflow utilizes https://github.com/actions/github-script in GitHub Actions to apply labels to pull requests.
1617
#
17-
1818
name: Label PR
19-
20-
on:
21-
- pull_request_target
22-
19+
on: [pull_request_target]
2320
jobs:
2421
label:
2522
runs-on: ubuntu-latest
@@ -30,7 +27,7 @@ jobs:
3027
- name: Label PR
3128
uses: actions/github-script@v4
3229
with:
33-
script: |
30+
script: |-
3431
const keywords = {
3532
"breaking": "kind/breaking",
3633
"bug": "kind/bug",

.github/workflows/obsolete.yaml

+17-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Licensed under the Apache License, Version 2.0 (the "License");
23
# you may not use this file except in compliance with the License.
34
# You may obtain a copy of the License at
@@ -16,33 +17,29 @@
1617
# For more information, see:
1718
# https://github.com/actions/stale
1819
name: Mark stale issues obsolete
19-
2020
on:
2121
schedule:
22-
- cron: '0 2 1,15 * *'
22+
- cron: 0 2 1,15 * *
2323
workflow_dispatch:
24-
25-
2624
jobs:
2725
stale:
28-
2926
runs-on: ubuntu-latest
3027
permissions:
3128
issues: write
3229
name: Track Obsolete Issues
33-
3430
steps:
35-
- name: Track stale issues and check if obsolete
36-
uses: actions/stale@v5
37-
with:
38-
repo-token: ${{ secrets.GITHUB_TOKEN }}
39-
days-before-issue-stale: 30
40-
stale-issue-message: >
41-
This issue is marked as obsolete due to inactivity for last 60 days.
42-
To avoid issue getting closed in next 30 days, please add a comment or add 'awaiting-maintainer' label. Thank you for your contributions
43-
stale-issue-label: 'obsolete'
44-
only-labels: 'stale'
45-
exempt-issue-labels: awaiting-maintainer
46-
remove-stale-when-updated: true
47-
ascending: true
48-
enable-statistics: true
31+
- name: Track stale issues and check if obsolete
32+
uses: actions/stale@v5
33+
with:
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
days-before-issue-stale: 30
36+
stale-issue-message: >
37+
This issue is marked as obsolete due to inactivity for last 60 days. To
38+
avoid issue getting closed in next 30 days, please add a comment or add
39+
'awaiting-maintainer' label. Thank you for your contributions
40+
stale-issue-label: obsolete
41+
only-labels: stale
42+
exempt-issue-labels: awaiting-maintainer
43+
remove-stale-when-updated: true
44+
ascending: true
45+
enable-statistics: true

.github/workflows/pr_update.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Copyright 2023 Google LLC
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,13 +17,10 @@
1617
# `main`. `update-pr-branch` will pick the oldest PR (by creation date) that is approved
1718
# with auto-merge enabled and update it to the latest `main`, forming a best-effort queue
1819
# of approved PRs.
19-
2020
name: PR update
21-
2221
on:
2322
push:
24-
branches:
25-
- "main"
23+
branches: [main]
2624
jobs:
2725
autoupdate:
2826
runs-on: ubuntu-latest
@@ -31,8 +29,8 @@ jobs:
3129
uses: adRise/[email protected]
3230
with:
3331
token: ${{ secrets.AGONES_BOT }}
34-
base: "main"
32+
base: main
3533
required_approval_count: 1
3634
require_passed_checks: true
37-
sort: "created"
38-
direction: "asc"
35+
sort: created
36+
direction: asc

.github/workflows/stale.yaml

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Licensed under the Apache License, Version 2.0 (the "License");
23
# you may not use this file except in compliance with the License.
34
# You may obtain a copy of the License at
@@ -15,32 +16,29 @@
1516
# You can adjust the behavior by modifying this file.
1617
# For more information, see:
1718
# https://github.com/actions/stale
18-
name: Mark stale
19-
19+
name: Mark stale
2020
on:
2121
workflow_dispatch:
2222
schedule:
23-
- cron: '0 10 1,15 * *'
24-
23+
- cron: 0 10 1,15 * *
2524
jobs:
2625
stale:
27-
2826
runs-on: ubuntu-latest
2927
permissions:
3028
issues: write
3129
name: stale issues
32-
3330
steps:
34-
- name: Stale issues
35-
uses: actions/stale@v5
36-
with:
37-
repo-token: ${{ secrets.GITHUB_TOKEN }}
38-
days-before-issue-stale: 30
39-
days-before-issue-close: 60
40-
stale-issue-message: >
41-
'This issue is marked as Stale due to inactivity for more than 30 days.
42-
To avoid being marked as 'stale' please add 'awaiting-maintainer' label or add a comment. Thank you for your contributions '
43-
stale-issue-label: 'stale'
44-
exempt-issue-labels: 'awaiting-maintainer, obsolete'
45-
ascending: true
46-
enable-statistics: true
31+
- name: Stale issues
32+
uses: actions/stale@v5
33+
with:
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
days-before-issue-stale: 30
36+
days-before-issue-close: 60
37+
stale-issue-message: >
38+
'This issue is marked as Stale due to inactivity for more than 30 days. To
39+
avoid being marked as 'stale' please add 'awaiting-maintainer' label or
40+
add a comment. Thank you for your contributions '
41+
stale-issue-label: stale
42+
exempt-issue-labels: awaiting-maintainer, obsolete
43+
ascending: true
44+
enable-statistics: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
.*
16+
!/.yamllint
1617
!.gitignore
1718
!.helmignore
1819
!.gitattributes

.golangci.yml

+6-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
---
12
# This file contains all available configuration options
23
# with their default values.
3-
44
# options for analysis running
55
run:
66
# default concurrency is a available CPU number
@@ -31,9 +31,7 @@ run:
3131
# no need to include all autogenerated files, we confidently recognize
3232
# autogenerated files. If it's not please let us know.
3333
skip-files:
34-
3534
modules-download-mode: vendor
36-
3735
# output configuration options
3836
output:
3937
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
@@ -44,7 +42,6 @@ output:
4442

4543
# print linter name in the end of issue text, default is true
4644
print-linter-name: true
47-
4845
linters:
4946
enable:
5047
- bodyclose
@@ -62,7 +59,6 @@ linters:
6259
- staticcheck
6360
- unconvert
6461
- unparam
65-
6662
linters-settings:
6763
govet:
6864
disable-all: false
@@ -71,32 +67,24 @@ linters-settings:
7167
# extremely noisy, also against common Go style in most cases
7268
- shadow
7369
gocritic:
74-
enabled-tags:
75-
- performance
76-
- opinionated
77-
- diagnostic
78-
disabled-checks:
79-
- paramTypeCombine
80-
- unnamedResult
81-
- unnecessaryDefer
82-
settings: # settings passed to gocritic
70+
enabled-tags: [performance, opinionated, diagnostic]
71+
disabled-checks: [paramTypeCombine, unnamedResult, unnecessaryDefer]
72+
settings: # settings passed to gocritic
8373
hugeParam:
8474
sizeThreshold: 512
8575
rangeValCopy:
8676
sizeThreshold: 512
8777
skipTestFuncs: true
88-
8978
issues:
9079
# This turns off the default excludes - which was causing the linter
9180
# to miss things like erroneous comments
9281
exclude-use-default: false
93-
exclude:
94-
- Using the variable on range scope .* in function literal
82+
exclude: [Using the variable on range scope .* in function literal]
9583
exclude-rules:
9684
# Skip fieldalignment checks on:
9785
# - tests: memory footprint doesn't matter
9886
# - cmd/: we assume these are one-off config entries
9987
# - pkg/apis: Keep strong convention on TypeMeta/ObjectMeta/Spec/Status
100-
- path: '(.+)_test\.go|^test/|^cmd/.*|^pkg/apis/.*'
88+
- path: (.+)_test\.go|^test/|^cmd/.*|^pkg/apis/.*
10189
# fieldalignment is in the `govet` linter, so exclude based on text instead of all of govet
10290
text: '^fieldalignment: .*'

.yamllint

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
truthy: disable
6+
line-length:
7+
max: 1500
8+
9+
ignore:
10+
- /build/.gomod/
11+
- /install/
12+
- /sdks/
13+
- /test/sdk/
14+
- /test/terraform/vendor/
15+
- /site/node_modules/
16+
- /site/themes/docsy/
17+
- /site/vendor/
18+
- /vendor/

build/Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,14 @@ build-extensions-binary-linux-arm64: $(ensure-build-image)
484484
-tags $(GO_BUILD_TAGS) -o $(go_build_base_path)/cmd/extensions/bin/extensions.linux.arm64 \
485485
$(go_rebuild_flags) $(go_version_flags) -installsuffix cgo $(agones_package)/cmd/extensions
486486

487-
# Lint the go source code.
487+
# Lint the go source code and yaml files.
488488
# use LINT_TIMEOUT to manipulate the linter timeout
489489
lint: LINT_TIMEOUT ?= 15m
490490
lint: $(ensure-build-image)
491491
docker run -t -e "TERM=xterm-256color" -e "$(gomod_on)" --rm $(common_mounts) -w $(workdir_path) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \
492-
"golangci-lint run ./examples/... && golangci-lint run --timeout $(LINT_TIMEOUT) ./..."
492+
"golangci-lint run ./examples/... && \
493+
golangci-lint run --timeout $(LINT_TIMEOUT) ./... && \
494+
yamllint ."
493495

494496
# Extract licenses from source tree
495497
build-licenses:

0 commit comments

Comments
 (0)