Created
July 20, 2020 09:28
-
-
Save Duologic/e6f4cde8052d6992ebeee6bb3024e31d to your computer and use it in GitHub Desktop.
Naive linter that looks for method-use in Jsonnet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
DIRNAME=$(dirname $0) | |
if [ "$#" != 1 ]; then | |
echo "Usage: `basename $0` <file_to_lint>" | |
exit 1 | |
fi | |
OUTPUT=$(cat $1 | sed 's/^ \+//g' | sed 's/^\/\/.*$//g' | sed 's/\(else\|then\|for\)/ \1 /g' | sed ':begin;$!N;s/\n//;tbegin' | sed 's/}/}\n/g' | grep --color=always ')\.[a-zA-Z0-9]\+(') | |
L=$(echo $OUTPUT | wc -l) | |
if [[ $L -gt 0 ]]; then | |
echo $1: | |
echo -e $OUTPUT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment