同步操作将从 Gitee 极速下载/Cppcheck 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/sh# Usage: add this file to your project's .git/hooks directory. Rename it to# just 'pre-commit'.# Now, when you change some files in repository and try to commit these# changes, git will run this script right before commit. Cppcheck will scan# changed/new files in repository. If it finds some issues, script returns with# exit code 1, rejecting commit. Otherwise, script returns 0, and you can# actually commit your changes.## Example:# $ cat hello.c# int main() {# int *s = malloc(10);# }# $ git add hello.c# $ git commit# Checking hello.c...# [hello.c:3]: (error) Memory leak: s# [hello.c:2]: (error) The allocated size 10 is not a multiple of the underlying type's size.## $ vim hello.c# $ cat hello.c# int main() {# }# $ git add hello.c# $ git commit# Checking hello.c...# $if git rev-parse --verify HEAD >/dev/null 2>&1thenagainst=HEADelse# Initial commit: diff against an empty tree objectagainst=4b825dc642cb6eb9a060e54bf8d69288fbee4904fi# We should pass only added or modified C/C++ source files to cppcheck.changed_files=$(git diff-index --cached $against | \grep -E '[MA] .*\.(c|cpp|cc|cxx)$' | cut -f 2)if [ -n "$changed_files" ]; thencppcheck --error-exitcode=1 $changed_filesexit $?fiexit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。