On Saturday 29 December 2012 07:11:17 PM Martin Gräßlin wrote: > On Saturday 29 December 2012 16:25:54 Albert Astals Cid wrote: > > > > Would there be any chance to have the style check done by a pre-commit hook? > > Or at least have a command-line tool that checks it for me? > yeah that should be possible. At my old day-job I created a pre-commit hook > to > basically grep for some common coding style violations. Only problem: it > checks for all files, so it would e.g. also check QML files which follow a > different coding style. > > Assuming we can perfectly check the coding style with astyle it would be > quite > nice to have that as a pre-commit hook. Would be very nice to have it in the > repos as it also moves away the nitpicks from code reviews. > > And no, Krazy check is for that too late as it's after commit.
If you have the Krazy command line tool installed (https://gitorious.org/krazy) then you could write a pre-commit hook that runs 'krazy2 --style' on the files being committed. Keeping in mind that I haven't tested the Krazy "kdelibs" style checker in a long time. But I am accepting bug reports and patches. -Allen