Skip to content

Commit 84128ce

Browse files
committed
CI: enable extra linters for new code
The idea here is to run some more picky linters only on new code, so we can keep the existing code as is, but impose some additional requirements to any new code. Currently, this enables godot linter which wants all comments to have a period at the end of the sentence. This makes sense because otherwise some comments might be read as unfinished. Obviously, no one wants to fix all the existing comments to have periods, but this will impose such requirement onto any new code (which also includes the code that is moved around). Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 0b482d0 commit 84128ce

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/validate.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
runs-on: ubuntu-20.04
2525
steps:
2626
- uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 2
2729
- uses: actions/setup-go@v3
2830
with:
2931
go-version: 1.x # latest stable
@@ -35,5 +37,11 @@ jobs:
3537
uses: golangci/golangci-lint-action@v3
3638
with:
3739
version: "${{ env.LINT_VERSION }}"
40+
# Extra linters, only checking new code from a pull request.
41+
- name: lint-extra
42+
if: github.event_name == 'pull_request'
43+
run: |
44+
golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 --out-format=github-actions
45+
3846
- name: validate seccomp
3947
run: ./tools/validate_seccomp.sh ./pkg/seccomp

.golangci-extra.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is golangci-lint config file which is used to check new code in
2+
# github PRs only (see lint-extra in .github/workflows/validate.yml).
3+
#
4+
# For the default linter config, see .golangci.yml. This config should
5+
# only enable additional linters not enabled in the default config.
6+
# The idea is to impose additional rules for newly added code only
7+
# (rules we can not realistically satisfy for existing code).
8+
9+
run:
10+
build-tags:
11+
- apparmor
12+
- seccomp
13+
- selinux
14+
- systemd
15+
- exclude_graphdriver_btrfs
16+
- containers_image_openpgp
17+
concurrency: 6
18+
deadline: 5m
19+
20+
linters:
21+
disable-all: true
22+
enable:
23+
- godot

0 commit comments

Comments
 (0)