-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuan Chen <[email protected]> Add verify and update to Makefile Signed-off-by: Yuan Chen <[email protected]>
- Loading branch information
1 parent
cc2121e
commit a4a52b6
Showing
1,173 changed files
with
203,496 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
# https://golangci-lint.run/usage/linters | ||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- depguard | ||
- dogsled | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- gci | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nilerr | ||
- nolintlint | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- whitespace | ||
|
||
linters-settings: | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(sigs.k8s.io/kwok) | ||
- blank | ||
- dot | ||
skip-generated: true | ||
custom-order: true | ||
importas: | ||
no-unaliased: true | ||
alias: | ||
# Kubernetes | ||
- pkg: k8s.io/api/core/v1 | ||
alias: corev1 | ||
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 | ||
alias: apiextensionsv1 | ||
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1 | ||
alias: metav1 | ||
- pkg: k8s.io/apimachinery/pkg/api/errors | ||
alias: apierrors | ||
staticcheck: | ||
go: "1.21" | ||
stylecheck: | ||
go: "1.21" | ||
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks | ||
checks: ["all", "-ST1000", "-ST1003"] | ||
depguard: | ||
rules: | ||
main: | ||
deny: | ||
# https://go.dev/doc/go1.16#ioutil | ||
- pkg: "io/ioutil" | ||
desc: "please see https://go.dev/doc/go1.16#ioutil" | ||
# Use sigs.k8s.io/kwok/pkg/log, which is a wrapper around slog | ||
- pkg: "k8s.io/klog/v2" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" | ||
- pkg: "k8s.io/klog" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" | ||
- pkg: "golang.org/x/exp/slog" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" | ||
- pkg: "log/slog" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" | ||
- pkg: "log" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" | ||
# Use sigs.k8s.io/kwok/pkg/utils/yaml, which is a wrapper around yaml | ||
- pkg: "k8s.io/apimachinery/pkg/util/yaml" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead" | ||
- pkg: "sigs.k8s.io/yaml" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead" | ||
# Use sigs.k8s.io/kwok/pkg/utils/wait, which is a wrapper around wait | ||
- pkg: "k8s.io/apimachinery/pkg/util/wait" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/utils/wait` instead" | ||
# Use sigs.k8s.io/kwok/pkg/utils/slices, which is a wrapper around slices | ||
- pkg: "k8s.io/utils/strings/slices" | ||
desc: "please use `sigs.k8s.io/kwok/pkg/utils/slices` instead" | ||
gocyclo: | ||
min-complexity: 50 | ||
gosec: | ||
excludes: | ||
- G110 | ||
- G304 | ||
config: | ||
G301: "0750" | ||
G302: "0640" | ||
G306: "0640" | ||
goconst: | ||
min-len: 5 | ||
min-occurrences: 10 | ||
ignore-tests: true | ||
match-constant: false | ||
revive: | ||
ignore-generated-header: true | ||
severity: error | ||
enable-all-rules: true | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md | ||
rules: | ||
- name: add-constant | ||
disabled: true | ||
- name: argument-limit | ||
disabled: true | ||
- name: cognitive-complexity | ||
disabled: true | ||
- name: confusing-naming | ||
disabled: true | ||
- name: cyclomatic | ||
disabled: true | ||
- name: early-return | ||
disabled: true | ||
- name: enforce-map-style | ||
disabled: true | ||
- name: exported | ||
disabled: true | ||
- name: file-header | ||
disabled: true | ||
- name: flag-parameter | ||
disabled: true | ||
- name: function-length | ||
disabled: true | ||
- name: get-return | ||
disabled: true | ||
- name: if-return | ||
disabled: true | ||
- name: import-shadowing | ||
disabled: true | ||
- name: line-length-limit | ||
disabled: true | ||
- name: modifies-parameter | ||
disabled: true | ||
- name: nested-structs | ||
disabled: true | ||
- name: optimize-operands-order | ||
disabled: true | ||
- name: unused-parameter | ||
disabled: true | ||
- name: unused-receiver | ||
disabled: true | ||
- name: use-any | ||
disabled: true | ||
- name: unchecked-type-assertion | ||
disabled: true | ||
- name: function-result-limit | ||
disabled: true | ||
- name: deep-exit | ||
disabled: true | ||
- name: superfluous-else | ||
disabled: true | ||
- name: confusing-results | ||
disabled: true | ||
- name: defer | ||
disabled: true | ||
- name: var-naming | ||
disabled: true | ||
- name: max-public-structs | ||
disabled: true | ||
- name: comment-spacings | ||
disabled: true | ||
- name: struct-tag | ||
disabled: true | ||
- name: unhandled-error | ||
disabled: true | ||
- name: error-strings | ||
disabled: true | ||
issues: | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant | ||
# changes in PRs and avoid nitpicking. | ||
exclude-use-default: false | ||
run: | ||
concurrency: 1 | ||
timeout: 10m | ||
allow-parallel-runners: false | ||
skip-dirs-use-default: true | ||
skip-files: | ||
- ".*\\.zz_generated\\..*" | ||
go: '1.21' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# configuration file rules | ||
# https://yamllint.readthedocs.io/en/stable/rules.html | ||
|
||
extends: default | ||
|
||
ignore-from-file: .gitignore | ||
|
||
rules: | ||
indentation: disable | ||
document-start: disable | ||
comments: disable | ||
line-length: disable | ||
truthy: | ||
check-keys: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
importas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
ROOT_DIR="$(realpath "${DIR}/..")" | ||
|
||
failed=() | ||
|
||
if [[ "${UPDATE_GO_FORMAT:-true}" == "true" ]]; then | ||
echo "[*] Update go format..." | ||
"${ROOT_DIR}"/hack/update-go-format.sh || failed+=(go-format) | ||
fi | ||
|
||
if [[ "${UPDATE_GO_MOD:-true}" == "true" ]]; then | ||
echo "[*] Update go mod..." | ||
"${ROOT_DIR}"/hack/update-go-mod.sh || failed+=(go-mod) | ||
fi | ||
|
||
if [[ "${UPDATE_GO_LINT:-true}" == "true" ]]; then | ||
echo "[*] Update go lint..." | ||
"${ROOT_DIR}"/hack/update-go-lint.sh || failed+=(go-lint) | ||
fi | ||
|
||
if [[ "${UPDATE_ENDS_NEWLINE:-true}" == "true" ]]; then | ||
echo "[*] Update ends newline..." | ||
"${ROOT_DIR}"/hack/update-ends-newline.sh || failed+=(ends-newline) | ||
fi | ||
|
||
if [[ "${UPDATE_SHELL_FORMAT:-true}" == "true" ]]; then | ||
echo "[*] Update shell format..." | ||
"${ROOT_DIR}"/hack/update-shell-format.sh || failed+=(shell-format) | ||
fi | ||
|
||
if [[ "${UPDATE_YAML_FORMAT:-true}" == "true" ]]; then | ||
echo "[*] Update yaml format..." | ||
"${ROOT_DIR}"/hack/update-yaml-format.sh || failed+=(yaml-format) | ||
fi | ||
|
||
if [[ "${UPDATE_SPELLING:-true}" == "true" ]]; then | ||
echo "[*] Update spelling..." | ||
"${ROOT_DIR}"/hack/update-spelling.sh || failed+=(spelling) | ||
fi | ||
|
||
if [[ "${#failed[@]}" != 0 ]]; then | ||
echo "Update failed for: ${failed[*]}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
ROOT_DIR="$(realpath "${DIR}/..")" | ||
|
||
function update_ends_newline() { | ||
find . \( \ | ||
-iname "*.md" \ | ||
-o -iname "*.sh" \ | ||
-o -iname "*.go" \ | ||
-o -iname "*.tpl" \ | ||
-o -iname "*.yaml" \ | ||
-o -iname "*.yml" \ | ||
\) \ | ||
-not \( \ | ||
-path ./.git/\* \ | ||
-o -path ./vendor/\* \ | ||
-o -path ./demo/node_modules/\* \ | ||
-o -path ./site/themes/\* \ | ||
\) \ | ||
-exec sh -c '[ -n "$(tail -c 1 $1)" ] && echo >> $1' sh {} \; | ||
} | ||
|
||
cd "${ROOT_DIR}" && update_ends_newline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
||
ROOT_DIR="$(realpath "${DIR}/..")" | ||
|
||
function format() { | ||
echo "Update go format" | ||
mapfile -t findfiles < <(find . \( \ | ||
-iname "*.go" \ | ||
\) \ | ||
-not \( \ | ||
-path ./vendor/\* \ | ||
-o -path ./demo/node_modules/\* \ | ||
-o -path ./site/themes/\* \ | ||
\)) | ||
gofmt -s -w "${findfiles[@]}" | ||
} | ||
|
||
cd "${ROOT_DIR}" && format |
Oops, something went wrong.