Add support for PreCommitEvent and fix broken tests