Thanks Bob!

On 2019-05-05 03:50, Bob Proulx wrote:
> wrote:
>> Does Anyone know if there are any GNU scripts for checking code sanity
>> as Git hooks?
>> I'm thinking about scripts for following the official coding style
>> guidelines. (C, C++, PHP, python...)
> The "standard" git hook that I enable for my own projects is the one
> that comes with git that says:
>   # This is slightly modified from Andrew Morton's Perfect Patch.
>   # Lines you introduce should not have trailing whitespace.
>   # Also check for an indentation that has SP before a TAB.
> That's fairly generic but enforces the basic rules that most projects
> benefit from having.  Prevents a lot of noisy whitespace errors from
> creeping into the change history.  Not enabled by default.

At my git installation I've not any sample script with these lines :-/
(git version 2.11.0)

I've been searching and found it in old Linux versions source code, but
using an external perl script. (is this one what you mean?)

But which is actually included with git also check whitespaces (and also
non ASCII filenames) I'll try it out.
> I am not aware of any git hooks that people are currently using for
> checking code sanity as you describe.  I am sure they do exist
> however.
> I recall seeing checks added at build time (for example my-distcheck
> targets as dependencies) that run checks at build time for various
> project specific items.  Presumably one will run distcheck targets
> before commiting and will be notified of problems found then.
> (However in git if someone has already committed locally then they can
> still rebase and fix their local working copy before pushing and
> publishing it.)
> No hooks are enabled on Savannah git repositories by default.  If you
> want one enabled then you have to ask for it to be enabled.  The
> admins are happy to work with you on getting custom hooks set up.
> Bob

I'm totally newbie with this, as a start I'm using a pre-commit hook
focused on python and PEP8 compliance.
I'll try out what you have said about my-distcheck and continue

Thanks a lot!

Reply via email to