aboutsummaryrefslogtreecommitdiffstats
path: root/tools/check-html.sh
blob: 1b122329e127215e0b4738ad0169801f276548eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# Copyright 2024 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

FILES=0
FAILED=""
for F in $(find . -name "*.html"); do
	((FILES+=1))
	TABS=`cat $F | grep "	"  | wc -l`
	# templates.html uses several spaces to format commit info using fixed-width font.
	SPACES=`cat $F | grep -v "Commit.Date" | grep "  "  | wc -l`
	if [ "$TABS" = "0" ] || [ "$SPACES" = "0" ]; then continue; fi
	# Ignore untracked files.
	git ls-files --error-unmatch $F >/dev/null 2>&1
	if [ $? -ne 0 ]; then continue; fi
	echo "$F:1:1: Uses both spaces ($SPACES) and tabs ($TABS) for formatting. Use either one of these."
	FAILED="1"
done
if [ "$FAILED" != "" ]; then exit 1; fi
echo "$FILES HTML files checked for formatting"