Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enforce Coding Standard for the repository located in GIthub

We have an account in Github and hosts all of our projects in Github (private repositories).

We want to enforce coding-standard and probably other hooks that we use for internal purpose. We have had these hooks work pretty well for subversion since the repository located in a single place, administering these hooks was excellent.

With Github, looks like I lose an ability to add my hooks in the main repository(?), hence I am struck:

  1. How do I enforce coding-standard to every member when they push their changes their files to the main repository?
  2. Is there any way on Github to execute my hooks present is my server before it process any push request?

I am looking for ideas/suggestions to make my life easier, any help is greatly appreciated.

like image 399
Rakesh Sankar Avatar asked Oct 18 '12 12:10

Rakesh Sankar


1 Answers

I don't think this is a job for the VCS. The thing is that tools that are helping to enforce coding standards are usually working with the source and sometimes with the binaries. For example in Java checkstyle can be run on source, but findbugs needs sources + compiled code. But as I understand running such tools on a patch is not effective enough. Those tools need context.

So I would recommend to create an instance of Continuous Integration Server like Jenkins and have it checkout code from Github if there are new changes, compile and run static analysis tools, the results of the build should be sent out to all team members. It will not only provide you feedback about pushed changes being properly coded, but also provide beneficial feedback if the code is stable from build perspective right away.

like image 79
Eugene Sajine Avatar answered Sep 19 '22 06:09

Eugene Sajine