Automatically Run the KRL Parser When You Commit Code


Running the command line KRL parser is a pain. Better to have a Git hook do it for you.


I'm tired of running the KRL parser from the command line every time I check in code. And based on the number of my students who've had problems with unparsable code that has been checked in, I'm not the only one.

I've been meaning to create a pre-commit hook for Git that runs the parser whenever you commit code. I just checked in code to the KRL Parser repo that provides a pre-commit hook that should work for users of Linux and OS X. If someone wants to create a Window's version, I'd be happy to include that in the repo. Just send me a pull request.

To use the hook, you need to copy pre-commit to the .git/hooks directory in your KRL repository and change the value of $PARSER to where you've installed the program. Note that you need to do this for any repository where you want the parser to automatically check KRL code. The hook checks every file with a .krl extension.

Overall, this works pretty well and will, over the course or time, save me time and effort.

Please leave comments using the sidebar.