initial commit
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Checks the given argument path (expected to be a tags file) for the correct tags style.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
STDLIB_PATH=$(realpath -e "$(dirname "$0")/..")
|
||||
source "$STDLIB_PATH/vendor/std/src/lib.sh"
|
||||
|
||||
FILEPATH=${1?Expected a file path as argument}
|
||||
|
||||
while read -r line; do
|
||||
IFS=$'\t' read -r name location _ctx ty <<<"$line"
|
||||
|
||||
[[ "$ty" == "f" ]] || continue
|
||||
|
||||
# if after splitting no subsegment is empty or invalid, then the separators
|
||||
# were used properly
|
||||
while read -r segment; do
|
||||
while read -r subsegment; do
|
||||
std::assert "$name: Subsegment should not be empty ($location)" -n "$subsegment"
|
||||
std::assert-regex "$name: Function subsegment '$subsegment' should be [a-z0-9] ($location)" "$subsegment" "^[a-z0-9]+$"
|
||||
done <<<"${segment//-/$' \n'}"
|
||||
done <<<"${name//::/$'\n'}"
|
||||
done <"$FILEPATH"
|
||||
Reference in New Issue
Block a user