lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Sep 2013 13:17:24 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: checkpatch guide for newbies

On Mon, 2013-09-23 at 11:06 -0700, Joe Perches wrote:
> Maybe I'll submit some auto-neatening script eventually
> and see what you think.

Maybe something like:

From: Joe Perches <joe@...ches.com>
Subject: [PATCH] scripts/fix_with_checkpatch.sh: Add a trivial script to fix simple style defects

Add a few whitespace and style corrections to individual files.

Create git commits for those changes too.

Signed-off-by: Joe Perches <joe@...ches.com>
---
 scripts/fix_with_checkpatch.sh | 52 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 scripts/fix_with_checkpatch.sh

diff --git a/scripts/fix_with_checkpatch.sh b/scripts/fix_with_checkpatch.sh
new file mode 100755
index 0000000..c47b111b
--- /dev/null
+++ b/scripts/fix_with_checkpatch.sh
@@ -0,0 +1,50 @@
+#/bin/sh
+
+whitespace_types="spacing space_before_tab pointer_location"
+changecode_types="c99_comments prefer_packed prefer_aligned avoid_externs parenthesis_alignment"
+
+checkpatch_update ()
+{
+    local file="$1"
+    type="$2"
+
+    ./scripts/checkpatch.pl --file --fix --strict --types=$type $file
+    if [ ! -f $file.EXPERIMENTAL-checkpatch-fixes ] ; then
+	return;
+    fi
+
+    mv $file.EXPERIMENTAL-checkpatch-fixes $file
+
+    git diff --stat -p $file | cat
+
+    obj="$(echo $file|sed 's/\.c$/\.o/')"
+
+    make $obj
+
+    tmpfile=$(mktemp git_commit.XXXXXX)
+    echo "$file: checkpatch neatening for $2" > $tmpfile
+    echo "" >> $tmpfile
+    echo "" >> $tmpfile
+
+    git commit -s -F $tmpfile -e $file
+
+    rm -f $tmpfile
+}
+
+for file in "$@"
+do
+
+    if [ ! -f $file ] ; then 
+	echo "Argument '$file' is not a file"
+	continue
+    fi
+
+    for type in $whitespace_types ; do
+	checkpatch_update $file $type
+    done
+
+    for type in $changecode_types ; do
+	checkpatch_update $file $type
+    done
+
+done
-- 
1.8.1.2.459.gbcd45b4.dirty



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ