07-31-2015, 04:56 PM
The other day I changed the CheckBasicStyle.lua script so that it can check individual files and even the files specifically being committed in Git. This comes handy as a git pre-commit hook - whenever you commit to git, CheckBasicStyle will check your commit before allowing you to actually commit it.
To enable:
Go to your .git/hooks folder, create a text file "pre-commit" there with the following contents:
On unix-like systems, you need to set the file as executable (chmod +x)
This is all it should take. If you want to disable the checks, just rename / remove the file.
I've found one problem so far, but I consider it a highly unlikely scenario:
If you edit a file, stage it for commit, then edit it again and finally commit, Git will commit the staged version, while CheckBasicStyle will check the edited version.
To enable:
Go to your .git/hooks folder, create a text file "pre-commit" there with the following contents:
Code:
#!/bin/sh
# Redirect output to stderr:
exec 1>&2
# Check the style of the files being committed:
exec src/CheckBasicStyle.lua -g
This is all it should take. If you want to disable the checks, just rename / remove the file.
I've found one problem so far, but I consider it a highly unlikely scenario:
If you edit a file, stage it for commit, then edit it again and finally commit, Git will commit the staged version, while CheckBasicStyle will check the edited version.