On Saturday 29 December 2012 19:11:17 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.
Note that something like that would be very welcome for me in KDevelop related projects as well. I've investigated it a few times already and it is sadly not yet perfectly feasable in my opinion. My approach was to format the new about- to-be-committed file and compare it to the unformatted file - if they both are equal everything is fine and we can continue. Otherwise some style guideline was violated and the commit was denied. While it was fairly trivial to write this up, the tool fails due to the imperfection of astyle and uncrustify. Both have still problems when formatting a few files, especially when it comes to macro usages or similar. Furthermore I was not yet able to write a "perfect" rule set for either astyle or uncrustify. Generally though, I would very much welcome any effort in that direction. If we could at least catch a few common issues it should help a lot. Cheers -- Milian Wolff [email protected] http://milianw.de
signature.asc
Description: This is a digitally signed message part.
