Replace the current linters and formatter in favour of Ruff in the
dts-check-format tool.

Bugzilla ID: 1358
Bugzilla ID: 1455

Signed-off-by: Luca Vizzarro <luca.vizza...@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepa...@arm.com>
---
 devtools/dts-check-format.sh | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh
index 3f43e17e88..44501f6d3b 100755
--- a/devtools/dts-check-format.sh
+++ b/devtools/dts-check-format.sh
@@ -52,18 +52,11 @@ if $format; then
        if command -v git > /dev/null; then
                if git rev-parse --is-inside-work-tree >&-; then
                        heading "Formatting in $directory/"
-                       if command -v black > /dev/null; then
-                               echo "Formatting code with black:"
-                               black .
+                       if command -v ruff > /dev/null; then
+                               echo "Formatting code with ruff:"
+                               ruff format
                        else
-                               echo "black is not installed, not formatting"
-                               errors=$((errors + 1))
-                       fi
-                       if command -v isort > /dev/null; then
-                               echo "Sorting imports with isort:"
-                               isort .
-                       else
-                               echo "isort is not installed, not sorting 
imports"
+                               echo "ruff is not installed, not formatting"
                                errors=$((errors + 1))
                        fi
 
@@ -89,11 +82,18 @@ if $lint; then
                echo
        fi
        heading "Linting in $directory/"
-       if command -v pylama > /dev/null; then
-               pylama .
-               errors=$((errors + $?))
+       if command -v ruff > /dev/null; then
+               ruff check --fix
+
+               git update-index --refresh
+               retval=$?
+               if [ $retval -ne 0 ]; then
+                       echo 'The "needs update" files have been fixed by the 
linter.'
+                       echo 'Please update your commit.'
+               fi
+               errors=$((errors + retval))
        else
-               echo "pylama not found, unable to run linter"
+               echo "ruff not found, unable to run linter"
                errors=$((errors + 1))
        fi
 fi
-- 
2.43.0

Reply via email to