Skip to content
Open
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
name: run prettier
description: format files with prettier
entry: prettier --write .
files: \.(md|ya?ml)$
files: \.(md|ya?ml|json)$
language: node
additional_dependencies: ['prettier@3.3.3']
- repo: https://github.com/jendrikseipp/vulture
Expand Down Expand Up @@ -64,7 +64,7 @@ repos:
args: [--allow-missing-credentials]
- id: detect-private-key
- id: end-of-file-fixer
exclude: \.out$|\.html$|^ast\.json$|^tokens\.json$
exclude: \.out$|\.html$
- id: fix-byte-order-marker
- id: forbid-submodules
- id: mixed-line-ending
Expand Down
2 changes: 1 addition & 1 deletion ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,4 @@
}
}
]
}
}
28 changes: 1 addition & 27 deletions b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,4 @@ if ! ./"$SALAM_OUTPUT" input.salam; then
echo "Program execution failed!"
exit 1
fi
echo "Program executed successfully."

# ────── Function to beautify JSON ──────
beautify_json_if_valid() {
local file="$1"
if [ -f "$file" ]; then
if command -v jq >/dev/null 2>&1; then
echo "Checking if $file is valid JSON..."
if jq empty "$file" >/dev/null 2>&1; then
echo "Beautifying $file using jq..."
jq . "$file" >"${file}.pretty" && mv "${file}.pretty" "$file"
echo "Beautification of $file complete."
else
echo "$file contains invalid JSON. Skipping beautification."
fi
else
echo "Warning: 'jq' is not installed. Skipping beautification of $file."
echo "To install: sudo apt install jq"
fi
else
echo "$file not found. Skipping beautification."
fi
}

# ────── Beautify JSON outputs ──────
beautify_json_if_valid "tokens.json"
beautify_json_if_valid "ast.json"
echo "Program executed successfully."
2 changes: 1 addition & 1 deletion tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,4 @@
"value": null
}
]
}
}
Loading