我在 Mac 上设置了pre-commit
挂钩,以避免提交rubocop错误:
echo -e "[RUBOCOP] Init..."
RUBOCOP=`bundle exec rubocop`
if [ "grep $RUBOCOP 'no offenses detected' -c" == "1" ]; then
echo -e "[RUBOCOP] approved."
exit 0
else
echo -e "[RUBOCOP] ✋ \n"
bundle exec rubocop
exit 1
fi
它在终端中运行得很好,但它弄乱了我的Github桌面应用程序 - 抛出这个错误:
[RUBOCOP]初始......
/Users/PATH_TO_PROJECT/.git/hooks/pre-commit:line 3:bundle:command not found
[RUBOCOP]✋
/Users/PATH_TO_PROJECT/.git/hooks/pre-commit:line 10:bundle:command not found
我搜索过,但没有发现任何相关内容,我也明白这个错误意味着什么。我无法弄清楚如何为Github Desktop启用bundle
或rubocop
命令。