github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/tools/check-language.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2020 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  shopt -s nocasematch
     8  for F in $(find . -name "*.go" -o -name "*.sh" -o -name "*.cc" -o -name "*.md" \
     9  	-o -name "*.S" -o -name "*.py" -o -name "*.yml" -o -name "*.yaml" | \
    10  	egrep -v "/vendor/|/gen/|executor/syscalls.h|dashboard/config/linux/bits|pkg/csource/generated.go|tools/check-language.sh"); do
    11  	((FILES+=1))
    12  	L=0
    13  	while IFS= read -r LINE; do
    14  		((L+=1))
    15  		if [[ $LINE =~ (slave|blacklist|whitelist) ]]; then
    16  			if [[ $LINE =~ bond_enslave ]]; then
    17  				continue
    18  			fi
    19  			SUGGESTIONS="block/allow/ignore/skip"
    20  			if [[ $LINE =~ (slave) ]]; then
    21  				SUGGESTIONS="leader/follower/coordinator/worker/parent/helper"
    22  			fi
    23  			echo "$F:$L:1: Please use more respectful terminology, consider using ${SUGGESTIONS} instead." \
    24  				"See https://tools.ietf.org/id/draft-knodel-terminology-01.html for more info."
    25  			echo "$LINE"
    26  			FAILED="1"
    27  		fi
    28  	done < "$F"
    29  done
    30  if [ "$FAILED" != "" ]; then exit 1; fi
    31  echo "$FILES files checked" >&2