From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E7CC42889; Fri, 31 Mar 2023 22:08:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19D1E410D7; Fri, 31 Mar 2023 22:08:30 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 291FE40E50 for ; Fri, 31 Mar 2023 22:08:29 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id iw3so22338121plb.6 for ; Fri, 31 Mar 2023 13:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1680293308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IpnuTdaGzfXTDfQG6A3OOAg23tyIG5zdf7twWgtrXYU=; b=OjvUcclZGy3BJxMKn6AM7BvnT2s7Yua8ilCYlAU8OcDX44UHV+lJH7JJPPTl+lCGpy FfOGNg/cakZD6+0luvlDai0Nx1cfEzb/As6YNtcXu3Z0zC7P0BJIRNJZx2xsz1ZsOC1H S3+mJat272sCCmmyJOV7G1jamdqG2l0qpkU45n727vhu4GMVW2IvTC6gS6EZ+96+sQTH F2hq0/8zgSMIFuPmZbE22mZ3KUA6BvtqBxeCJxCwCmSgtVwVv+dRMvybxARNqYLP9S4E ijI9rijhDwu7F0qt8pgxbrkS89uJBeMZPFIye+YArieGAICLSCGjjRz9CdzdwC2e1sUo 843Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680293308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IpnuTdaGzfXTDfQG6A3OOAg23tyIG5zdf7twWgtrXYU=; b=ntEPrp5VuksIb5Q667mbgYeQY1UYvLv0Uy1nc1rVMW2BS/4/ZS0+Ip4kHinbvag1eb eBXLNU0ZG9ZwniawetqCsdkhhcymAQaaE7C15dSYpgXC0ZyoBKGZjwvPgTj/xIfZXBV1 FOIS0SOu08NTwn8Pd6iwiNCMDrsV/FEW3Umi9OCmQ4LK7MVtWR9w8KQt/rQ0UN/6aEXp NoCSM8wB+SNbyiGsukUNaCw3W8L2k8vHpZN/08OS+uWXEVVUe5Md1bX5ydjXU27Rxp8S GzukjIjf+OyqWNmS4KOBMN4DD1uOFPlsYOUkdvDMEB0wYAPVtTODLNNDqbDWn+04EGGr GALQ== X-Gm-Message-State: AO0yUKU/uIM6tVhPY1SFQjyTPT4YB1JlUuEX74gHs5czIUAII/JJ+2zl q3KUA5/5jlcR1fMkI/I6pMqZ1NpxSEh5N7RwPpIUMg== X-Google-Smtp-Source: AK7set+nuP6VRh1Jw7UH4+FuazsIcUe7cv8vtFSvJMnA/1Mbm9yMIXZTO5ZSroQmskd8mC5ZyQ4t9g== X-Received: by 2002:a05:6a20:6730:b0:db:df13:4f73 with SMTP id q48-20020a056a20673000b000dbdf134f73mr24151040pzh.26.1680293307725; Fri, 31 Mar 2023 13:08:27 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id y1-20020aa78541000000b0056d7cc80ea4sm2199368pfn.110.2023.03.31.13.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:08:27 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH] devtools: add script to check for non inclusive naming Date: Fri, 31 Mar 2023 13:08:24 -0700 Message-Id: <20230331200824.195294-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Shell script to find use of words that not be used. By default it prints matches. The -q (quiet) option is used to just count. There is also -l option which lists lines matching (like grep -l). Examples: $ ./devtools/check-naming.sh -q Total files: 37 errors, 90 warnings, 1 suggestions $ ./devtools/check-naming.sh -q -l Total lines: 121 errors, 255 warnings, 1 suggestions Uses the word lists from Inclusive Naming Initiative see https://inclusivenaming.org/word-lists/ Signed-off-by: Stephen Hemminger --- devtools/check-naming.sh | 89 +++++++++++++++++++++++++++++++++++++++ devtools/naming/tier1.txt | 8 ++++ devtools/naming/tier2.txt | 1 + devtools/naming/tier3.txt | 3 ++ 4 files changed, 101 insertions(+) create mode 100755 devtools/check-naming.sh create mode 100644 devtools/naming/tier1.txt create mode 100644 devtools/naming/tier2.txt create mode 100644 devtools/naming/tier3.txt diff --git a/devtools/check-naming.sh b/devtools/check-naming.sh new file mode 100755 index 000000000000..2a25eaa2eef9 --- /dev/null +++ b/devtools/check-naming.sh @@ -0,0 +1,89 @@ +#! /bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# +# Produce a list of files with non-inclusive naming + +errors=0 +warnings=0 +suggestions=0 +quiet=false +veborse=false +lines='-l' + +print_usage () { + echo "usage: $(basename $0) [-l] [-q] [-v]" + exit 1 +} + +# Locate word list files +selfdir=$(dirname $(readlink -f $0)) +words=$selfdir/naming + +# These give false positives +skipfiles=( ':^devtools/naming/' \ + ':^doc/guides/rel_notes/' \ + ':^doc/guides/contributing/coding_style.rst' \ + ':^doc/guides/prog_guide/glossary.rst' \ +) +# These are obsolete +skipfiles+=( \ + ':^drivers/net/liquidio/' \ + ':^drivers/net/bnx2x/' \ + ':^lib/table/' \ + ':^lib/port/' \ + ':^lib/pipeline/' \ + ':^examples/pipeline/' \ +) + +# +# check_wordlist wordfile description +check_wordlist() { + local list=$words/$1 + local description=$2 + + git grep -i $lines -f $list -- ${skipfiles[@]} > $tmpfile + count=$(wc -l < $tmpfile) + if ! $quiet; then + if [ $count -gt 0 ]; then + if $verbose; then + echo $description + echo $description | tr '[:print:]' '-' + fi + cat $tmpfile + echo + fi + fi + return $count +} + +while getopts lqvh ARG ; do + case $ARG in + l ) lines= ;; + q ) quiet=true ;; + v ) verbose=true ;; + h ) print_usage ; exit 0 ;; + ? ) print_usage ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +tmpfile=$(mktemp -t dpdk.checknames.XXXXXX) +trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT + +check_wordlist tier1.txt "Tier 1: Replace immediately" +errors=$? + +check_wordlist tier2.txt "Tier 2: Strongly consider replacing" +warnings=$? + +check_wordlist tier3.txt "Tier 3: Recommend to replace" +suggestions=$? + +if [ -z "$lines" ] ; then + echo -n "Total lines: " +else + echo -n "Total files: " +fi + +echo $errors "errors," $warnings "warnings," $suggestions "suggestions" +exit $errors diff --git a/devtools/naming/tier1.txt b/devtools/naming/tier1.txt new file mode 100644 index 000000000000..46532f2b234b --- /dev/null +++ b/devtools/naming/tier1.txt @@ -0,0 +1,8 @@ +abort +blackhat +whitehat +cipple +master +slave +whitelist +blacklist diff --git a/devtools/naming/tier2.txt b/devtools/naming/tier2.txt new file mode 100644 index 000000000000..cd4280d1625c --- /dev/null +++ b/devtools/naming/tier2.txt @@ -0,0 +1 @@ +sanity diff --git a/devtools/naming/tier3.txt b/devtools/naming/tier3.txt new file mode 100644 index 000000000000..0f9586ff5bac --- /dev/null +++ b/devtools/naming/tier3.txt @@ -0,0 +1,3 @@ +man.in.the.middle +segregate +tribe -- 2.39.2