Skip to content

Commit b1ae969

Browse files
authored
Update lint_xrefs.sh
1 parent aafa718 commit b1ae969

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

scripts/lint_xrefs.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,23 @@ while IFS=: read -r filepath link; do
2323
status=1
2424
fi
2525
done < <(
26-
git --no-pager grep --no-color -I -P -o \
27-
'(?!.*@lint-ignore)(?:\[[^]]+\]\([^[:space:])]*/[^[:space:])]*\)|href="[^"]*/[^"]*"|src="[^"]*/[^"]*")' \
28-
-- '*' \
29-
':(exclude).*' \
30-
':(exclude)**/.*' \
31-
':(exclude)**/*.lock' \
32-
':(exclude)**/*.svg' \
33-
':(exclude)**/*.xml' \
34-
':(exclude,glob)**/third-party/**' \
35-
':(exclude,glob)**/third_party/**' \
26+
pattern='(?!.*@lint-ignore)(?:\[[^]]+\]\([^[:space:]\)]+/[^[:space:]\)]+\)|href="[^"]*/[^"]*"|src="[^"]*/[^"]*")'
27+
excludes=(
28+
':(exclude,glob)**/.*'
29+
':(exclude,glob)**/*.lock'
30+
':(exclude,glob)**/*.svg'
31+
':(exclude,glob)**/*.xml'
32+
':(exclude,glob)**/*.gradle*'
33+
':(exclude,glob)**/*gradle*'
34+
':(exclude,glob)**/third-party/**'
35+
':(exclude,glob)**/third_party/**'
36+
)
37+
if [ $# -gt 0 ]; then
38+
paths=("$@")
39+
else
40+
paths=('*')
41+
fi
42+
git --no-pager grep --no-color -I -P -o "$pattern" -- "${paths[@]}" "${excludes[@]}" \
3643
| grep -Ev 'https?://' \
3744
| sed -E \
3845
-e 's#([^:]+):\[[^]]+\]\(([^)]+)\)#\1:\2#' \

0 commit comments

Comments
 (0)