github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/tools/check-html.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2024 syzkaller project authors. All rights reserved.
     3  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     4  
     5  FILES=0
     6  FAILED=""
     7  for F in $(find . -name "*.html"); do
     8  	((FILES+=1))
     9  	TABS=`cat $F | grep "	"  | wc -l`
    10  	# templates.html uses several spaces to format commit info using fixed-width font.
    11  	SPACES=`cat $F | grep -v "Commit.Date" | grep "  "  | wc -l`
    12  	if [ "$TABS" = "0" ] || [ "$SPACES" = "0" ]; then continue; fi
    13  	# Ignore untracked files.
    14  	git ls-files --error-unmatch $F >/dev/null 2>&1
    15  	if [ $? -ne 0 ]; then continue; fi
    16  	echo "$F:1:1: Uses both spaces ($SPACES) and tabs ($TABS) for formatting. Use either one of these."
    17  	FAILED="1"
    18  done
    19  if [ "$FAILED" != "" ]; then exit 1; fi
    20  echo "$FILES HTML files checked for formatting"