Skip to content

Commit b16a46e

Browse files
committed
Update fix-yamllint to use a new stand-alone script
Implement a new stand-alone script to move the target body out of the Makefile. Signed-off-by: Ivan Valdes <[email protected]>
1 parent 1f1750b commit b16a46e

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,9 @@ endif
164164
verify-markdown-marker:
165165
PASSES="markdown_marker" ./scripts/test.sh
166166

167-
YAMLFMT_VERSION = $(shell cd tools/mod && go list -m -f '{{.Version}}' github.com/google/yamlfmt)
168-
169167
.PHONY: fix-yamllint
170168
fix-yamllint:
171-
ifeq (, $(shell command -v yamlfmt))
172-
$(shell go install github.com/google/yamlfmt/cmd/yamlfmt@$(YAMLFMT_VERSION))
173-
endif
174-
yamlfmt -conf tools/.yamlfmt .
169+
./scripts/fix/yamllint.sh
175170

176171
.PHONY: run-govulncheck
177172
run-govulncheck:

scripts/fix/yamllint.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2025 The etcd Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Fixes linter issues in YAML files.
17+
18+
set -euo pipefail
19+
20+
ETCD_ROOT_DIR=${ETCD_ROOT_DIR:-$(git rev-parse --show-toplevel)}
21+
source "${ETCD_ROOT_DIR}/scripts/test_lib.sh"
22+
23+
function main {
24+
run_go_tool github.com/google/yamlfmt/cmd/yamlfmt \
25+
-conf "${ETCD_ROOT_DIR}/tools/.yamlfmt" .
26+
}
27+
28+
# only run when called directly, not sourced
29+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
30+
main
31+
fi

0 commit comments

Comments
 (0)