Skip to content

Commit 6770816

Browse files
committed
lint: Updated the linter definitions.
1 parent b946b69 commit 6770816

File tree

3 files changed

+235
-127
lines changed

3 files changed

+235
-127
lines changed

.golangci.yml

+17-14
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ output:
138138
uniq-by-line: false
139139

140140
# Add a prefix to the output file references. Default is no prefix.
141-
path-prefix: ""
141+
path-prefix: ''
142142

143143
# Sort results by: filepath, line and column.
144144
sort-results: true
@@ -299,7 +299,7 @@ linters-settings:
299299
- NOTE
300300
- OPTIMIZE
301301
- TODO
302-
- "@todo"
302+
- '@todo'
303303

304304
# goerr113:
305305

@@ -309,7 +309,7 @@ linters-settings:
309309

310310
gofumpt:
311311
# Select the Go version to target.
312-
lang-version: "1.21"
312+
lang-version: '1.21'
313313

314314
# Module path which contains the source code being formatted.
315315
# Default: ""
@@ -341,8 +341,8 @@ linters-settings:
341341
# List of numbers to exclude from analysis. The numbers should be written as
342342
# string. Values always ignored: "1", "1.0", "0" and "0.0" Default: []
343343
ignored-numbers:
344-
- "0666"
345-
- "0755"
344+
- '0666'
345+
- '0755'
346346

347347
# List of file patterns to exclude from analysis.
348348
# Values always ignored: `.+_test.go`
@@ -468,8 +468,7 @@ linters-settings:
468468

469469
# List of aliases
470470
# Default: []
471-
alias:
472-
[]
471+
alias: []
473472
# # Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package.
474473
# - pkg: knative.dev/serving/pkg/apis/serving/v1
475474
# alias: servingv1
@@ -547,7 +546,7 @@ linters-settings:
547546
staticcheck:
548547
# Select the Go version to target.
549548
# Default: "1.13"
550-
go: "1.21"
549+
go: '1.21'
551550

552551
# https://staticcheck.io/docs/options#checks
553552
# https://staticcheck.io/docs/checks/
@@ -558,7 +557,7 @@ linters-settings:
558557
stylecheck:
559558
# Select the Go version to target.
560559
# Default: 1.13
561-
go: "1.21"
560+
go: '1.21'
562561

563562
# https://staticcheck.io/docs/options#checks
564563
# https://staticcheck.io/docs/checks/
@@ -691,8 +690,7 @@ linters-settings:
691690

692691
# An array of strings that specify regular expressions of interfaces to ignore.
693692
# Default: []
694-
ignoreInterfaceRegexps:
695-
[]
693+
ignoreInterfaceRegexps: []
696694
# - ^(?i)c(?-i)ach(ing|e)
697695

698696
wsl:
@@ -756,11 +754,11 @@ issues:
756754
exclude:
757755
- should have a package comment
758756
- declaration of "(err|ctx)" shadows declaration at
759-
- "`Println` arg list ends with redundant newline"
757+
- '`Println` arg list ends with redundant newline'
760758
- Println arg list ends with redundant newline
761759
- type jsonschema.Schema has no field or method ValidateBytes
762760
- declarations should never be cuddled
763-
- "unnamedResult: consider giving a name to these results"
761+
- 'unnamedResult: consider giving a name to these results'
764762

765763
# Excluding configuration per-path, per-linter, per-text and per-source
766764
exclude-rules:
@@ -785,7 +783,7 @@ issues:
785783
- gomnd
786784
source: lint:allow_raw_number
787785

788-
- text: "commentedOutCode: may want to remove commented-out code"
786+
- text: 'commentedOutCode: may want to remove commented-out code'
789787
linters:
790788
- gocritic
791789
source: lint:allow_commented
@@ -846,6 +844,11 @@ issues:
846844
- unused
847845
source: lint:allow_unused
848846

847+
- text: (is a program, not an importable package)
848+
linters:
849+
- typecheck
850+
source: lint:allow_importable_program
851+
849852
# Independently from option `exclude` we use default exclude patterns, it can be disabled by this
850853
# option. To list all excluded by default patterns execute `golangci-lint run --help`. Default
851854
# value for this option is true.

.pre-commit-config.yaml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
default_language_version:
5+
python: python3.11
6+
7+
default_stages:
8+
- commit
9+
- push
10+
11+
fail_fast: false
12+
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: d20d9444dfc759ebeeff1643f213132bb4dd491f
16+
hooks:
17+
- id: check-added-large-files
18+
args:
19+
- --maxkb=500
20+
- --enforce-all
21+
- id: check-case-conflict
22+
- id: check-executables-have-shebangs
23+
- id: check-json
24+
- id: check-merge-conflict
25+
- id: check-symlinks
26+
- id: check-toml
27+
- id: check-xml
28+
- id: check-yaml
29+
args:
30+
- --allow-multiple-documents
31+
- id: destroyed-symlinks
32+
- id: detect-private-key
33+
- id: end-of-file-fixer
34+
- id: fix-byte-order-marker
35+
- id: fix-encoding-pragma
36+
args:
37+
- --remove
38+
- id: mixed-line-ending
39+
args:
40+
- --fix=lf
41+
- id: requirements-txt-fixer
42+
- id: trailing-whitespace
43+
44+
- repo: https://github.com/asottile/pyupgrade
45+
rev: c21b4c4d153be0633357686c7697f539ac194868
46+
hooks:
47+
- id: pyupgrade
48+
args:
49+
- --py311-plus
50+
51+
- repo: https://github.com/asottile/reorder_python_imports
52+
rev: c4fe43d9809f1507508b3aba24ad1a72b5407f58
53+
hooks:
54+
- id: reorder-python-imports
55+
args:
56+
- --py311-plus
57+
58+
- repo: https://github.com/skyzyx/git-hooks
59+
rev: 4a2f0dc93e5c5353ed5e619599b0d15e34df88db
60+
hooks:
61+
- id: checkov
62+
args:
63+
- --directory=.
64+
- --framework=terraform
65+
- --quiet
66+
- --compact
67+
- --skip-check=CKV_AWS_50,CKV_AWS_116,CKV_AWS_173,CKV_AWS_115
68+
- id: git-check
69+
- id: gofumpt
70+
- id: golangci-lint
71+
# - id: go-consistent
72+
- id: gomodupdate
73+
- id: markdownlint
74+
args:
75+
- --ignore=node_modules
76+
- --ignore=.github
77+
- --ignore=.templates
78+
- --fix
79+
- id: script-must-have-extension
80+
- id: shellcheck
81+
- id: shfmt
82+
- id: terraform-fmt
83+
- id: terrascan
84+
- id: tfsec
85+
- id: yamlfmt
86+
- id: yapf

0 commit comments

Comments
 (0)