Hi,
We want to implement pre-commit hook in SVN to check code formatting in jsp/java files. If the submited files do not pass the guidelines, it should not commit and indicate the lines in error.
How can we implement it? Please guide.
Hi,
We want to implement pre-commit hook in SVN to check code formatting in jsp/java files. If the submited files do not pass the guidelines, it should not commit and indicate the lines in error.
How can we implement it? Please guide.
Information about how to implement hooks can be found here.
I would start off by writing a script, or choosing an existing application, that checks the code of a single *.java file. Since a *.jsp file contains slightly different syntax I would to the same for *.jsp files - keeping those scripts separate.
Writing a script that traverses the file structure of commit can easily be written in Bash/Python. This script should just call your previous syntax check scripts for each *.java file and *.jsp file.
Last not but not least, the traversal script(s) should be added to the pre-commit hook script on your Subversion server.