-
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]> Remove venv Revert changes Signed-off-by: Yuan Chen <[email protected]> Add yamlfmt Signed-off-by: Yuan Chen <[email protected]> Remove golangci.yaml Fix goling config file names
- Loading branch information
1 parent
24ced76
commit 48a3a9c
Showing
22 changed files
with
817 additions
and
0 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,4 @@ | ||
formatter: | ||
type: basic | ||
indentless_arrays: true | ||
retain_line_breaks_single: true |
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
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 |
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,26 @@ | ||
#!/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}/..")" | ||
|
||
COMMAND=(go run github.com/golangci/golangci-lint/cmd/[email protected]) | ||
|
||
cd "${ROOT_DIR}" && "${COMMAND[@]}" run -c "${ROOT_DIR}/.golangci.yml" --fix |
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,24 @@ | ||
#!/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}/..")" | ||
|
||
cd "${ROOT_DIR}" && go mod tidy |
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 shell format" | ||
mapfile -t findfiles < <(find . \( \ | ||
-iname "*.sh" \ | ||
\) \ | ||
-not \( \ | ||
-path ./vendor/\* \ | ||
-o -path ./demo/node_modules/\* \ | ||
-o -path ./site/themes/\* \ | ||
\)) | ||
go run mvdan.cc/sh/v3/cmd/[email protected] -w -i=2 "${findfiles[@]}" | ||
} | ||
|
||
cd "${ROOT_DIR}" && format |
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,47 @@ | ||
#!/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}/..")" | ||
|
||
allowed_spelling_words="${ROOT_DIR}/hack/spelling.txt" | ||
|
||
function update() { | ||
local ignore | ||
ignore="$(tr <"${allowed_spelling_words}" '\n' ',')" | ||
mapfile -t files < <(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/\* \ | ||
\)) | ||
go run github.com/client9/misspell/cmd/[email protected] \ | ||
-locale US -w -i "${ignore}" "${files[@]}" | ||
} | ||
|
||
cd "${ROOT_DIR}" && update |
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,40 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 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 yaml format" | ||
mapfile -t findfiles < <(find . \( \ | ||
-iname "*.yaml" \ | ||
-o -iname "*.yml" \ | ||
\) \ | ||
-not \( \ | ||
-path ./vendor/\* \ | ||
-o -path ./demo/node_modules/\* \ | ||
-o -path ./site/themes/\* \ | ||
-o -path ./kustomize/crd/bases/\* \ | ||
-o -path ./kustomize/rbac/\* \ | ||
\)) | ||
go run github.com/google/yamlfmt/cmd/[email protected] -conf .yamlfmt.yaml "${findfiles[@]}" | ||
} | ||
|
||
cd "${ROOT_DIR}" && format |
Oops, something went wrong.