File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025 Digg - Agency for Digital Government
2+ #
3+ # SPDX-License-Identifier: CC0-1.0
4+
5+ # Default yamlfmt configuration for devbase-justkit
6+ # Projects can override this by creating their own .yamlfmt file
7+
8+ exclude:
9+ - target/
10+ - node_modules/
11+ - vendor/
12+ - dist/
13+ - build/
14+ - generated-sources/
15+ - "**/*generated*"
16+
17+ formatter:
18+ type: basic
19+ retain_line_breaks_single: true
Original file line number Diff line number Diff line change @@ -11,8 +11,21 @@ source "${SCRIPT_DIR}/../utils/colors.sh"
1111
1212readonly ACTION=" ${1:- check} "
1313
14+ # Default config with standard exclusions
15+ readonly DEFAULT_CONFIG=" ${SCRIPT_DIR} /config/.yamlfmt"
16+
17+ get_config_flag () {
18+ # If project has its own config, use default behavior; otherwise use our default
19+ if [[ ! -f " .yamlfmt" && ! -f " yamlfmt.yml" && ! -f " yamlfmt.yaml" && -f " ${DEFAULT_CONFIG} " ]]; then
20+ printf " %s" " -conf ${DEFAULT_CONFIG} "
21+ fi
22+ }
23+
1424check_yaml () {
15- if yamlfmt -lint . ; then
25+ local conf_flag
26+ conf_flag=$( get_config_flag)
27+ # shellcheck disable=SC2086
28+ if yamlfmt -lint $conf_flag . ; then
1629 print_success " YAML linting passed"
1730 return 0
1831 else
@@ -22,7 +35,10 @@ check_yaml() {
2235}
2336
2437fix_yaml () {
25- if yamlfmt . ; then
38+ local conf_flag
39+ conf_flag=$( get_config_flag)
40+ # shellcheck disable=SC2086
41+ if yamlfmt $conf_flag . ; then
2642 print_success " YAML files formatted"
2743 return 0
2844 else
You can’t perform that action at this time.
0 commit comments