Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions scripts/kyaml-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,7 @@ for f in "$@"; do
echo "::error file=$f::kyaml-format: $f is not KYAML — run scripts/kyaml-format.sh $f" >&2
drift=$((drift + 1))
else
target="$(readlink -f "$f")" || {
refuse "$f" "could not resolve the rewrite target"; continue
}
rewrite_tmp="$(mktemp "$(dirname "$target")/.kyaml-format.XXXXXX")" || {
refuse "$f" "could not create a temporary file beside the target"; continue
}
if ! cp -p "$target" "$rewrite_tmp" || ! cat "$out" > "$rewrite_tmp" || ! mv "$rewrite_tmp" "$target"; then
rm -f "$rewrite_tmp"
refuse "$f" "could not rewrite the file"; continue
fi
cat "$out" > "$f"
echo "kyaml-format: rewrote $f"
rewritten=$((rewritten + 1))
fi
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/jcs_oracle.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{"input":{"€":"euro","A":"fullwidth A","a":"first"},"expected":"{\"a\":\"first\",\"€\":\"euro\",\"A\":\"fullwidth A\"}"}
{"input":{"😀":"astral first?","A":"high bmp"},"expected":"{\"😀\":\"astral first?\",\"A\":\"high bmp\"}"}
{"input":{"d":[3,1,2],"e":{"z":1,"y":{"x":[true,false,null]}}},"expected":"{\"d\":[3,1,2],\"e\":{\"y\":{\"x\":[true,false,null]},\"z\":1}}"}
{"input":[4.50,2.4499999999999998e16,1E+30,0.000001,1E-7,1E+21,1E+20,1E-33,-0.0,0.0,9.9999999999999997E+22],"expected":"[4.5,24500000000000000,1e+30,0.000001,1e-7,1e+21,100000000000000000000,1e-33,0,0,1e+23]"}
{"input":[4.50,24499999999999998,1E+30,0.000001,1E-7,1E+21,1E+20,1E-33,-0.0,0.0,9.9999999999999997E+22],"expected":"[4.5,24500000000000000,1e+30,0.000001,1e-7,1e+21,100000000000000000000,1e-33,0,0,1e+23]"}
{"input":[0.000001,1E-7,1.5E-10,9007199254740991,-42],"expected":"[0.000001,1e-7,1.5e-10,9007199254740991,-42]"}
{"input":{"s\":with\"quotes":"tab\there\nnewline","esc\\":"\\backslash","ctl":"\u0001\u001f"},"expected":"{\"ctl\":\"\\u0001\\u001f\",\"esc\\\\\":\"\\\\backslash\",\"s\\\":with\\\"quotes\":\"tab\\there\\nnewline\"}"}
{"input":{"nested":{"arr":[{"n":1.0},{"m":2}],"deep":{"deeper":{"deepest":"value"}}}},"expected":"{\"nested\":{\"arr\":[{\"n\":1},{\"m\":2}],\"deep\":{\"deeper\":{\"deepest\":\"value\"}}}}"}
Expand Down
Loading