Re: [git-users] Enforce C# code style with git hooks

2015-01-14 Thread Peter van der Does
On 01/13/2015 02:35 PM, Marko Paloski wrote:
> Hello,
> 
> I want to make i script that check the code style in the commit, so if
> don't matches, it will not allow the developers to commit the code.
> 
> The script will be in pre-commit local or in pre-recieve on the server.
> I find something about uncrustify :
> http://www.itk.org/pipermail/insight-developers/2010-September/015333.html
> http://uncrustify.sourceforge.net/
> https://github.com/bengardner/uncrustify
> 
> 
> But i don't know how to implement. Yes it can be bash or powershell script.
> Thanks,
> 

In the file .git/hooks/precommit you run the uncrustify analysis and
depending on the result, you exit the script with 0 if it was ok, and 1
if it was not ok.

If you exit with a 1 the commit will not be done.

-- 
Peter van der Does

GPG key: CB317D6E

Site: http://avirtualhome.com
GitHub: https://github.com/petervanderdoes
Twitter: @petervanderdoes

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Enforce C# code style with git hooks

2015-01-14 Thread Peter van der Does
On 01/14/2015 11:02 AM, Thomas Ferris Nicolaisen wrote:
> On Wednesday, January 14, 2015 at 3:47:17 PM UTC+1, Peter van der Does
> wrote:
> 
> 
> I don't know uncrustify, how can you tell with uncrustify if code is
> not
> in your preferred code style?
> 
> 
> 
> There are a myriad of tools like this:
> http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
> 
> They're basically some executable that run through a path of source
> files, parse them, do some analysis, and spit out a report that is
> either read by humans or used by some machine/script to notify the
> programmer that the code does not conform to their configured standards.
> 

So how does uncrustify report back? Error codes, One liner, full report
in console, report in file etc etc etc.



-- 
Peter van der Does

GPG key: CB317D6E

Site: http://avirtualhome.com
GitHub: https://github.com/petervanderdoes
Twitter: @petervanderdoes

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Enforce C# code style with git hooks

2015-01-14 Thread Thomas Ferris Nicolaisen
On Wednesday, January 14, 2015 at 3:47:17 PM UTC+1, Peter van der Does 
wrote:
>
>
> I don't know uncrustify, how can you tell with uncrustify if code is not 
> in your preferred code style? 
>
>
>
There are a myriad of tools like this: 
http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis

They're basically some executable that run through a path of source files, 
parse them, do some analysis, and spit out a report that is either read by 
humans or used by some machine/script to notify the programmer that the 
code does not conform to their configured standards.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Enforce C# code style with git hooks

2015-01-14 Thread Peter van der Does
On 01/13/2015 02:35 PM, Marko Paloski wrote:
> Hello,
> 
> I want to make i script that check the code style in the commit, so if
> don't matches, it will not allow the developers to commit the code.
> 
> The script will be in pre-commit local or in pre-recieve on the server.
> I find something about uncrustify :
> http://www.itk.org/pipermail/insight-developers/2010-September/015333.html
> http://uncrustify.sourceforge.net/
> https://github.com/bengardner/uncrustify
> 
> 
> But i don't know how to implement. Yes it can be bash or powershell script.
> Thanks,
> 

I don't know uncrustify, how can you tell with uncrustify if code is not
in your preferred code style?


-- 
Peter van der Does

GPG key: CB317D6E

Site: http://avirtualhome.com
GitHub: https://github.com/petervanderdoes
Twitter: @petervanderdoes

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.