Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 9 Apr 2015 17:05:38 +0800
From: Kai Zhao <loverszhao@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: Coding Style

I changed checkpatch.pl a little to make it work for john. The attachment is
the patch that add the checkpatch.pl to john.

1. Apply my patch.

2. Secondly we should add git pre-commit hook for the script.

Edit the .git/hooks/pre-commit file to contain only the following two lines:

--------------------------------------------------------------------------------
#!/bin/sh
exec git diff --cached | run/checkpatch.pl --no-signoff - || true
--------------------------------------------------------------------------------

3. Enjoy it

For example, add a long string in src/john.c

--------------------------------------------------------------------------------
--- a/src/john.c
+++ b/src/john.c
@@ -1510,6 +1510,7 @@ static void john_done(void)

 int main(int argc, char **argv)
 {
+       char *long_string = "This is a long string which exceeds column 80
 This is a long string which exceeds column 80";
        char *name;
        unsigned int time;
--------------------------------------------------------------------------------

$ git add src/john.c
$ git commit -m "test checkpatch: add a long string"

--------------------------------------------------------------------------------
WARNING: line over 80 characters
#9: FILE: src/john.c:1513:
+ char *long_string = "This is a long string which exceeds column 80  This
is a long string which exceeds column 80";

total: 0 errors, 1 warnings, 7 lines checked

Your patch has style problems, please review.
--------------------------------------------------------------------------------

After you commit, this hook will output any checkpatch errors or warnings
that
your patch creates. And the changes were committed even though there are
errors and warnings.

If you see warnings or errors that you know you added, you can amend the
commit by changing the file, using 'git add' to add the changes, and then
using 'git commit --amend' to commit the changes.

Thanks,

Kai

[ CONTENT OF TYPE text/html SKIPPED ]

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ