From d1d862e2eafeae859977006c55bdd11f5b0b0c1c Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 23 Feb 2024 03:10:03 +0900 Subject: [PATCH] tidy: Check TOML format --- .taplo.toml | 9 +++++++++ tools/tidy.sh | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .taplo.toml diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..2e09733 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,9 @@ +# Taplo configuration +# https://taplo.tamasfe.dev/configuration/formatter-options.html + +[formatting] +align_comments = false +allowed_blank_lines = 1 +array_auto_collapse = false +array_auto_expand = false +indent_string = " " diff --git a/tools/tidy.sh b/tools/tidy.sh index 383cb3f..0e1bbbe 100755 --- a/tools/tidy.sh +++ b/tools/tidy.sh @@ -238,6 +238,21 @@ if [[ -n "$(git ls-files '*.yaml')" ]]; then git ls-files '*.yaml' fi +# TOML (if exists) +if [[ -n "$(git ls-files '*.toml')" ]]; then + info "checking TOML style" + if [[ ! -e .taplo.toml ]]; then + warn "could not found .taplo.toml in the repository root" + fi + if type -P npm &>/dev/null; then + echo "+ npx -y @taplo/cli fmt \$(git ls-files '*.toml')" + npx -y @taplo/cli fmt $(git ls-files '*.toml') + check_diff $(git ls-files '*.toml') + else + warn "'npm' is not installed; skipped TOML style check" + fi +fi + # Markdown (if exists) if [[ -n "$(git ls-files '*.md')" ]]; then info "checking Markdown style"