Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

Like Eugene says, I'm not sure if this is really is a task of a VCS. (but probably there is a place where you can hook this).

Since you're using Github, are you familiar with the Commit Status API? That way you can setup a service (like Jenkins), which automatically checks the coding style, and for example run unit tests so you can see if the pull request is "clean" or "safe".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top