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

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

commit 0a66cbdcdd67b4f5e3d9c44cbc18871008a04369
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed Feb 1 07:22:39 2023 +0800

    tools/checkpatch: Should check the spell and encoding for rust file too
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 tools/checkpatch.sh | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 1324235de0..13dd0e67f4 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -62,29 +62,25 @@ check_file() {
   if [ "$(is_rust_file $@)" == "1" ]; then
     if ! command -v rustfmt &> /dev/null; then
       fail=1
-    else
-      if ! rustfmt --edition 2021 --check $@ 2>&1; then
-        fail=1
-      fi
-    fi
-  else
-    if ! $TOOLDIR/nxstyle $@ 2>&1; then
+    elif ! rustfmt --edition 2021 --check $@ 2>&1; then
       fail=1
     fi
+  elif ! $TOOLDIR/nxstyle $@ 2>&1; then
+    fail=1
+  fi
 
-    if [ $spell != 0 ]; then
-      if ! codespell -q 7 ${@: -1}; then
-        fail=1
-      fi
+  if [ $spell != 0 ]; then
+    if ! codespell -q 7 ${@: -1}; then
+      fail=1
     fi
+  fi
 
-    if [ $encoding != 0 ]; then
-      md5="$(md5sum $@)"
-      cvt2utf convert --nobak "$@" &> /dev/null
-      if [ "$md5" != "$(md5sum $@)" ]; then
-        echo "$@: error: Non-UTF8 characters detected!"
-        fail=1
-      fi
+  if [ $encoding != 0 ]; then
+    md5="$(md5sum $@)"
+    cvt2utf convert --nobak "$@" &> /dev/null
+    if [ "$md5" != "$(md5sum $@)" ]; then
+      echo "$@: error: Non-UTF8 characters detected!"
+      fail=1
     fi
   fi
 }

Reply via email to