Skip to content

Commit 9e1272d

Browse files
committed
Separate tfproviderlint into .golangci.custom.yml config
Use `make` to compile config files for `golangci-lint`. This enables using the default GCL config with a bare non-custom install of GCL Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 320dda1 commit 9e1272d

4 files changed

Lines changed: 74 additions & 64 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ testdata/
3030
!tools/tfproviderlint/**/testdata/
3131
website/vendor
3232
terraform-provider-github
33+
.golangci.custom.local.yml
3334
.golangci.new.yml
3435

3536
# Test exclusions

.golangci.custom.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: "2"
2+
3+
linters:
4+
default: none
5+
6+
enable:
7+
- tfproviderlint
8+
9+
settings:
10+
custom:
11+
tfproviderlint:
12+
type: module
13+
description: Reports Terraform provider linting issues.
14+
original-url: github.com/bflad/tfproviderlint/cmd/tfproviderlintx
15+
settings:
16+
# https://github.com/bflad/tfproviderlint/tree/main?tab=readme-ov-file#standard-acceptance-test-checks
17+
enabled-checks:
18+
- AT005 # https://github.com/bflad/tfproviderlint/tree/main/passes/AT005
19+
- AT008 # https://github.com/bflad/tfproviderlint/tree/main/passes/AT008
20+
- R005 # https://github.com/bflad/tfproviderlint/tree/main/passes/R005
21+
- R006 # https://github.com/bflad/tfproviderlint/tree/main/passes/R006
22+
- R011 # https://github.com/bflad/tfproviderlint/tree/main/passes/R011
23+
- R012 # https://github.com/bflad/tfproviderlint/tree/main/passes/R012
24+
- R013 # https://github.com/bflad/tfproviderlint/tree/main/passes/R013
25+
- R015 # https://github.com/bflad/tfproviderlint/tree/main/passes/R015
26+
- R016 # https://github.com/bflad/tfproviderlint/tree/main/passes/R016
27+
- R017 # https://github.com/bflad/tfproviderlint/tree/main/passes/R017
28+
- S001 # https://github.com/bflad/tfproviderlint/tree/main/passes/S001
29+
- S002 # https://github.com/bflad/tfproviderlint/tree/main/passes/S002
30+
- S003 # https://github.com/bflad/tfproviderlint/tree/main/passes/S003
31+
- S004 # https://github.com/bflad/tfproviderlint/tree/main/passes/S004
32+
- S005 # https://github.com/bflad/tfproviderlint/tree/main/passes/S005
33+
- S007 # https://github.com/bflad/tfproviderlint/tree/main/passes/S007
34+
- S008 # https://github.com/bflad/tfproviderlint/tree/main/passes/S008
35+
- S009 # https://github.com/bflad/tfproviderlint/tree/main/passes/S009
36+
- S010 # https://github.com/bflad/tfproviderlint/tree/main/passes/S010
37+
- S011 # https://github.com/bflad/tfproviderlint/tree/main/passes/S011
38+
- S012 # https://github.com/bflad/tfproviderlint/tree/main/passes/S012
39+
- S014 # https://github.com/bflad/tfproviderlint/tree/main/passes/S014
40+
- S015 # https://github.com/bflad/tfproviderlint/tree/main/passes/S015
41+
- S016 # https://github.com/bflad/tfproviderlint/tree/main/passes/S016
42+
- S017 # https://github.com/bflad/tfproviderlint/tree/main/passes/S017
43+
- S018 # https://github.com/bflad/tfproviderlint/tree/main/passes/S018
44+
- S021 # https://github.com/bflad/tfproviderlint/tree/main/passes/S021
45+
- S022 # https://github.com/bflad/tfproviderlint/tree/main/passes/S022
46+
- S023 # https://github.com/bflad/tfproviderlint/tree/main/passes/S023
47+
- S024 # https://github.com/bflad/tfproviderlint/tree/main/passes/S024
48+
- S025 # https://github.com/bflad/tfproviderlint/tree/main/passes/S025
49+
- S026 # https://github.com/bflad/tfproviderlint/tree/main/passes/S026
50+
- S027 # https://github.com/bflad/tfproviderlint/tree/main/passes/S027
51+
- S028 # https://github.com/bflad/tfproviderlint/tree/main/passes/S028
52+
- S029 # https://github.com/bflad/tfproviderlint/tree/main/passes/S029
53+
- S030 # https://github.com/bflad/tfproviderlint/tree/main/passes/S030
54+
- S031 # https://github.com/bflad/tfproviderlint/tree/main/passes/S031
55+
- S032 # https://github.com/bflad/tfproviderlint/tree/main/passes/S032
56+
- S033 # https://github.com/bflad/tfproviderlint/tree/main/passes/S033
57+
- S035 # https://github.com/bflad/tfproviderlint/tree/main/passes/S035
58+
- S036 # https://github.com/bflad/tfproviderlint/tree/main/passes/S036
59+
- S037 # https://github.com/bflad/tfproviderlint/tree/main/passes/S037
60+
- XR004 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR004
61+
- XR006 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR006
62+
- XR008 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR008
63+
# Custom local checks
64+
- L001 # file:///./tools/tfproviderlint/checks/L001/L001.go

.golangci.yml

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -26,64 +26,6 @@ linters:
2626
- unparam
2727
- unused
2828
- usetesting
29-
- tfproviderlint
30-
31-
settings:
32-
custom:
33-
tfproviderlint:
34-
type: module
35-
description: Reports Terraform provider linting issues.
36-
original-url: github.com/bflad/tfproviderlint/cmd/tfproviderlintx
37-
settings:
38-
# https://github.com/bflad/tfproviderlint/tree/main?tab=readme-ov-file#standard-acceptance-test-checks
39-
enabled-checks:
40-
- AT005 # https://github.com/bflad/tfproviderlint/tree/main/passes/AT005
41-
- AT008 # https://github.com/bflad/tfproviderlint/tree/main/passes/AT008
42-
- R005 # https://github.com/bflad/tfproviderlint/tree/main/passes/R005
43-
- R006 # https://github.com/bflad/tfproviderlint/tree/main/passes/R006
44-
- R011 # https://github.com/bflad/tfproviderlint/tree/main/passes/R011
45-
- R012 # https://github.com/bflad/tfproviderlint/tree/main/passes/R012
46-
- R013 # https://github.com/bflad/tfproviderlint/tree/main/passes/R013
47-
- R015 # https://github.com/bflad/tfproviderlint/tree/main/passes/R015
48-
- R016 # https://github.com/bflad/tfproviderlint/tree/main/passes/R016
49-
- R017 # https://github.com/bflad/tfproviderlint/tree/main/passes/R017
50-
- S001 # https://github.com/bflad/tfproviderlint/tree/main/passes/S001
51-
- S002 # https://github.com/bflad/tfproviderlint/tree/main/passes/S002
52-
- S003 # https://github.com/bflad/tfproviderlint/tree/main/passes/S003
53-
- S004 # https://github.com/bflad/tfproviderlint/tree/main/passes/S004
54-
- S005 # https://github.com/bflad/tfproviderlint/tree/main/passes/S005
55-
- S007 # https://github.com/bflad/tfproviderlint/tree/main/passes/S007
56-
- S008 # https://github.com/bflad/tfproviderlint/tree/main/passes/S008
57-
- S009 # https://github.com/bflad/tfproviderlint/tree/main/passes/S009
58-
- S010 # https://github.com/bflad/tfproviderlint/tree/main/passes/S010
59-
- S011 # https://github.com/bflad/tfproviderlint/tree/main/passes/S011
60-
- S012 # https://github.com/bflad/tfproviderlint/tree/main/passes/S012
61-
- S014 # https://github.com/bflad/tfproviderlint/tree/main/passes/S014
62-
- S015 # https://github.com/bflad/tfproviderlint/tree/main/passes/S015
63-
- S016 # https://github.com/bflad/tfproviderlint/tree/main/passes/S016
64-
- S017 # https://github.com/bflad/tfproviderlint/tree/main/passes/S017
65-
- S018 # https://github.com/bflad/tfproviderlint/tree/main/passes/S018
66-
- S021 # https://github.com/bflad/tfproviderlint/tree/main/passes/S021
67-
- S022 # https://github.com/bflad/tfproviderlint/tree/main/passes/S022
68-
- S023 # https://github.com/bflad/tfproviderlint/tree/main/passes/S023
69-
- S024 # https://github.com/bflad/tfproviderlint/tree/main/passes/S024
70-
- S025 # https://github.com/bflad/tfproviderlint/tree/main/passes/S025
71-
- S026 # https://github.com/bflad/tfproviderlint/tree/main/passes/S026
72-
- S027 # https://github.com/bflad/tfproviderlint/tree/main/passes/S027
73-
- S028 # https://github.com/bflad/tfproviderlint/tree/main/passes/S028
74-
- S029 # https://github.com/bflad/tfproviderlint/tree/main/passes/S029
75-
- S030 # https://github.com/bflad/tfproviderlint/tree/main/passes/S030
76-
- S031 # https://github.com/bflad/tfproviderlint/tree/main/passes/S031
77-
- S032 # https://github.com/bflad/tfproviderlint/tree/main/passes/S032
78-
- S033 # https://github.com/bflad/tfproviderlint/tree/main/passes/S033
79-
- S035 # https://github.com/bflad/tfproviderlint/tree/main/passes/S035
80-
- S036 # https://github.com/bflad/tfproviderlint/tree/main/passes/S036
81-
- S037 # https://github.com/bflad/tfproviderlint/tree/main/passes/S037
82-
- XR004 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR004
83-
- XR006 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR006
84-
- XR008 # https://github.com/bflad/tfproviderlint/tree/main/passes/XR008
85-
# Custom local checks
86-
- L001 # file:///./tools/tfproviderlint/checks/L001/L001.go
8729

8830
exclusions:
8931
generated: lax

GNUmakefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@ fmt: tools
5252
@echo "==> Fixing source code formatting..."
5353
$(BIN)/custom-gcl fmt ./... ./tools/...
5454

55-
lint: tools
55+
.golangci.custom.local.yml: .golangci.yml .golangci.custom.yml
56+
@yq eval-all 'select(fileIndex == 0) *+ select(fileIndex == 1)' .golangci.yml .golangci.custom.yml > .golangci.custom.local.yml
57+
58+
lint: tools .golangci.custom.local.yml
5659
@echo "==> Checking source code against linters and fixing..."
57-
$(BIN)/custom-gcl run --fix ./...
60+
$(BIN)/custom-gcl run --fix ./... --config .golangci.custom.local.yml
5861

59-
lintcheck: tools
62+
lintcheck: tools .golangci.custom.local.yml
6063
@branch=$$(git rev-parse --abbrev-ref HEAD); \
6164
printf "==> Checking source code against linters on branch: \033[1m%s\033[0m...\n" "🌿 $$branch 🌿"
62-
$(BIN)/custom-gcl run ./...
65+
$(BIN)/custom-gcl run ./... --config .golangci.custom.local.yml
6366

64-
.golangci.new.yml: .golangci.yml .golangci.strict.yml
65-
@yq eval-all 'select(fileIndex == 0) *+ select(fileIndex == 1)' .golangci.yml .golangci.strict.yml > .golangci.new.yml
67+
.golangci.new.yml: .golangci.yml .golangci.custom.yml .golangci.strict.yml
68+
@yq eval-all 'select(fileIndex == 0) *+ select(fileIndex == 1) *+ select(fileIndex == 2)' .golangci.yml .golangci.custom.yml .golangci.strict.yml > .golangci.new.yml
6669

6770
lintcheck-new: tools .golangci.new.yml
6871
@branch=$$(git rev-parse --abbrev-ref HEAD); \

0 commit comments

Comments
 (0)