Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1198531pxb; Mon, 11 Oct 2021 00:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8mRx8FTj1en1sy8d2JN2Uy4auoJQG8HUZJvTAhJkRGy/JWUHsMU4LtZni3NHiNwNqW4xg X-Received: by 2002:a17:906:1706:: with SMTP id c6mr23859862eje.343.1633935898947; Mon, 11 Oct 2021 00:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633935898; cv=none; d=google.com; s=arc-20160816; b=OV6N7I1JER7dVqCOdiKZVoUTNFbte/8ZBYwtoQrPrydvPpH+j7ykdhYUcJ3R9wb4Z1 NaFl9BRrnctsdhdRkdJp9jpdKnRC6yRU8mnAJyGldzgVCHiE1FuCPEPvH9ur8ncKSSHe QtY5vqIV7rib05wRn+NhVVnqkz4pl6UoNU8jDglHgwBZsqjL+N0qMHHQ+zvMCCg4mE8V DG7HBGAYPhL218tnqpyhhZQbwC3vFvxcmsls3YD5tTmv48QwPp9fK85Ip9jBcs8y84qD wLaIp2UgOfk6SNzvIUsJSBLSAATlOcI1i3gd0mjcx6HpffAuoJcj19m2bBXYAviaxzbP Zwqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=halyNdCOylb7YQgMFAC45d1/6oVwWjbnIXxU5Z7cn4U=; b=ucK4LchYq7tcvSkEABip5aMl2b8NRGGlxBpRV1E7FidP99L+ERV9GsFyHbCPsYp86/ RrKYy8RP0s+PFHO3uvvLHW72fpF26A5vSmHx8B1Wp940I350rX+Hu8vIzFedL9Vb55LF b12QMw7dyknsYBtJ3EvLcKd/P6NAYq6TqoWAG4g3P7DRUtjuWmvX6KlFpdmZcU46Hfnh geochKf/ql7BAb2Pqyx9Cc/uMPCJjLkqkGVxx4nxW8/iqoGE3breTF0MW313I+GgutcK VrCmRyHHXKxpWfR2YAfG3eOyDkKeXeHFPCJopkQddI8lT0OiXA2tlcCCthuqEkM1VjDY /FXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de2si11342247edb.378.2021.10.11.00.04.35; Mon, 11 Oct 2021 00:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234207AbhJKGeY (ORCPT + 99 others); Mon, 11 Oct 2021 02:34:24 -0400 Received: from mga09.intel.com ([134.134.136.24]:31414 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231425AbhJKGeW (ORCPT ); Mon, 11 Oct 2021 02:34:22 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10133"; a="226707140" X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="226707140" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:32:23 -0700 X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="479728460" Received: from acleivam-mobl1.amr.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.249.40.144]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:32:21 -0700 From: Peter Ujfalusi To: apw@canonical.com, joe@perches.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org Subject: [PATCH v2] checkpatch: get default codespell dictionary path from package location Date: Mon, 11 Oct 2021 09:32:31 +0300 Message-Id: <20211011063231.6918-1-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The standard location of dictionary.txt is under codespell's package, on my machine atm (codespell 2.1, Artix Linux): /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary.txt Since we enable the codespell by default for SOF I have constant: No codespell typos will be found - \ file '/usr/share/codespell/dictionary.txt': No such file or directory The patch proposes to try to fix up the path following the recommendation found here: https://github.com/codespell-project/codespell/issues/1540 Signed-off-by: Peter Ujfalusi --- Hi, Changes sicne v1: - add missing ';' to the line updating the $codespellfile with $codespell_dict Regards, Peter scripts/checkpatch.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c27d2312cfc3..fe11f2cb9f71 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -73,6 +73,12 @@ my $git_command ='export LANGUAGE=en_US.UTF-8; git'; my $tabsize = 8; my ${CONFIG_} = "CONFIG_"; +# Override the codespellfile location based on codespell install location +if (which("codespell") ne "" && which("python") ne "") { + my $codespell_dict = `python -c "import os.path as op; import codespell_lib; print(op.join(op.dirname(codespell_lib.__file__), 'data', 'dictionary.txt'), end='')" 2> /dev/null`; + $codespellfile = $codespell_dict if (-e $codespell_dict); +} + sub help { my ($exitcode) = @_; @@ -130,7 +136,7 @@ Options: --ignore-perl-version override checking of perl version. expect runtime errors. --codespell Use the codespell dictionary for spelling/typos - (default:/usr/share/codespell/dictionary.txt) + (default:$codespellfile) --codespellfile Use this codespell dictionary --typedefsfile Read additional types from this file --color[=WHEN] Use colors 'always', 'never', or only when output -- 2.33.0