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@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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 kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html