mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Provide list of files to link linters if desired (#152352)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/152352 Approved by: https://github.com/huydhn
This commit is contained in:
committed by
PyTorch MergeBot
parent
c8540984a2
commit
d79e06723d
@ -13,7 +13,6 @@ running_jobs() {
|
||||
}
|
||||
|
||||
while IFS=: read -r filepath url; do
|
||||
fpath="$filepath"
|
||||
(
|
||||
code=$(curl -k -gsLm30 --retry 3 --retry-delay 3 --retry-connrefused -o /dev/null -w "%{http_code}" -I "$url") || code=000
|
||||
if [ "$code" -lt 200 ] || [ "$code" -ge 400 ]; then
|
||||
@ -42,10 +41,10 @@ while IFS=: read -r filepath url; do
|
||||
fi
|
||||
fi
|
||||
if [ "$code" -lt 200 ] || [ "$code" -ge 400 ]; then
|
||||
printf "${red}%s${reset} ${yellow}%s${reset} %s\n" "$code" "$url" "$fpath" >&2
|
||||
printf "${red}%s${reset} ${yellow}%s${reset} %s\n" "$code" "$url" "$filepath" >&2
|
||||
exit 1
|
||||
else
|
||||
printf "${green}%s${reset} ${cyan}%s${reset} %s\n" "$code" "$url" "$fpath"
|
||||
printf "${green}%s${reset} ${cyan}%s${reset} %s\n" "$code" "$url" "$filepath"
|
||||
exit 0
|
||||
fi
|
||||
) &
|
||||
@ -53,19 +52,24 @@ while IFS=: read -r filepath url; do
|
||||
while [ "$(running_jobs)" -ge "$max_jobs" ]; do
|
||||
sleep 1
|
||||
done
|
||||
done < <(
|
||||
git --no-pager grep --no-color -I -P -o \
|
||||
'(?!.*@lint-ignore)(?<!git\+)(?<!\$\{)https?://(?![^\s<>\")]*[<>\{\}\$])[^[:space:]<>\")\[\]\(\\]+' \
|
||||
-- '*' \
|
||||
':(exclude).*' \
|
||||
':(exclude,glob)**/.*' \
|
||||
':(exclude,glob)**/*.lock' \
|
||||
':(exclude,glob)**/*.svg' \
|
||||
':(exclude,glob)**/*.xml' \
|
||||
':(exclude,glob)**/*.gradle*' \
|
||||
':(exclude,glob)**/*gradle*' \
|
||||
':(exclude,glob)**/third-party/**' \
|
||||
':(exclude,glob)**/third_party/**' \
|
||||
done < <(
|
||||
pattern='(?!.*@lint-ignore)(?<!git\+)(?<!\$\{)https?://(?![^\s<>\")]*[<>\{\}\$])[^[:space:]<>")\[\]\\]+'
|
||||
excludes=(
|
||||
':(exclude,glob)**/.*'
|
||||
':(exclude,glob)**/*.lock'
|
||||
':(exclude,glob)**/*.svg'
|
||||
':(exclude,glob)**/*.xml'
|
||||
':(exclude,glob)**/*.gradle*'
|
||||
':(exclude,glob)**/*gradle*'
|
||||
':(exclude,glob)**/third-party/**'
|
||||
':(exclude,glob)**/third_party/**'
|
||||
)
|
||||
if [ $# -gt 0 ]; then
|
||||
paths=("$@")
|
||||
else
|
||||
paths=('*')
|
||||
fi
|
||||
git --no-pager grep --no-color -I -P -o "$pattern" -- "${paths[@]}" "${excludes[@]}" \
|
||||
| sed -E 's/[^/[:alnum:]]+$//' \
|
||||
| grep -Ev '://(0\.0\.0\.0|127\.0\.0\.1|localhost)([:/])' \
|
||||
| grep -Ev 'fwdproxy:8080' \
|
||||
|
@ -18,16 +18,23 @@ while IFS=: read -r filepath link; do
|
||||
status=1
|
||||
fi
|
||||
done < <(
|
||||
git --no-pager grep --no-color -I -P -o \
|
||||
'(?!.*@lint-ignore)(?:\[[^]]+\]\([^[:space:])]*/[^[:space:])]*\)|href="[^"]*/[^"]*"|src="[^"]*/[^"]*")' \
|
||||
-- '*' \
|
||||
':(exclude).*' \
|
||||
':(exclude)**/.*' \
|
||||
':(exclude)**/*.lock' \
|
||||
':(exclude)**/*.svg' \
|
||||
':(exclude)**/*.xml' \
|
||||
':(exclude,glob)**/third-party/**' \
|
||||
':(exclude,glob)**/third_party/**' \
|
||||
pattern='(?!.*@lint-ignore)(?:\[[^]]+\]\([^[:space:]\)]+/[^[:space:]\)]+\)|href="[^"]*/[^"]*"|src="[^"]*/[^"]*")'
|
||||
excludes=(
|
||||
':(exclude,glob)**/.*'
|
||||
':(exclude,glob)**/*.lock'
|
||||
':(exclude,glob)**/*.svg'
|
||||
':(exclude,glob)**/*.xml'
|
||||
':(exclude,glob)**/*.gradle*'
|
||||
':(exclude,glob)**/*gradle*'
|
||||
':(exclude,glob)**/third-party/**'
|
||||
':(exclude,glob)**/third_party/**'
|
||||
)
|
||||
if [ $# -gt 0 ]; then
|
||||
paths=("$@")
|
||||
else
|
||||
paths=('*')
|
||||
fi
|
||||
git --no-pager grep --no-color -I -P -o "$pattern" -- "${paths[@]}" "${excludes[@]}" \
|
||||
| grep -Ev 'https?://' \
|
||||
| sed -E \
|
||||
-e 's#([^:]+):\[[^]]+\]\(([^)]+)\)#\1:\2#' \
|
||||
|
Reference in New Issue
Block a user