You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/07/07 15:43:50 UTC

(nuttx) 02/02: tools/checkpatch.sh: simplify Python file type check.

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f725c593877b78d48140f3523ae0e9e685da569c
Author: zhongzhijie1 <zh...@xiaomi.com>
AuthorDate: Wed Jul 2 16:13:24 2025 +0800

    tools/checkpatch.sh: simplify Python file type check.
    
    Use existing is_python_file() helper to replace manual string comparison
    when checking Python file types.
    
    Signed-off-by: zhongzhijie1 <zh...@xiaomi.com>
---
 tools/checkpatch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 84aaa46bff7..ae0ebc7c9d8 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -95,7 +95,7 @@ is_cmake_file() {
 }
 
 format_file() {
-  if [ ${@##*.} == 'py' ]; then
+  if [ "$(is_python_file $@)" == "1" ]; then
     if command -v black >/dev/null; then
       echo "Auto-formatting Python file with black: $@"
       setupcfg="${TOOLDIR}/../.github/linters/setup.cfg"