[cvsnt] Trigger to enforce certain code via regex, and Audit "diff" field
Howard Ha
bluespire at gmail.com
Wed Nov 5 20:21:38 GMT 2008
In my case I only want to test for 2 things really:
1) parse errors in php scripts (which I can do using a shell command)
2) people committing specific debug code (looks like {debug} or debug())
Both of the above things are simple "pass" or "fail" tests. Our problem
was that people were accidentally leaving in the debug code every so
often. its never intentionally committed so the developers would not
try to get around it.
I was able to do this thanks to the hints from Gabriel and some digging
around.
I ended up using this in commitinfo:
ALL /usr/local/bin/php /home/validate_cvs_commit.php %P %p %<s
instead of what Gabriel recommended because in my case cvsnt was
creating temp folders in /tmp/cvs-serv9330 where the 9330 was some sort
of session info. the %P parameter gave me this information, and I
iterate through the entire folder getting all files, then I test them all.
Works like a charm now!
Howard
Arthur Barrett wrote:
>> 2) Is there any way to create a commit trigger of some sort,
>> that will
>> allow us to run a regex, or script to do some validation of
>> code, before
>> allowing a commit? We'd like to prevent developers from
>> committing code
>> that contains certain debug code.
>>
>
> From memory the file being committed is in the current directory during
> the execution of one of the triggers... Loginfo maybe?
>
> Generally this sort of thing doesn't work - it's the same as trying to
> prevent 'poor' commit messages, developers will find a way around it.
> Better to have a code review stage and if it is picked up then hit the
> developer with a 'big stick'.
>
> Regards,
>
>
> Arthur Barrett
>
>
More information about the cvsnt
mailing list