Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
fb7cbb34
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
fb7cbb34
编写于
6月 28, 2022
作者:
H
Hui Zhang
提交者:
GitHub
6月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2088 from zh794390558/cpplint
[tools] cpplint
上级
59f67db1
532aeb8d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
0 deletion
+75
-0
.pre-commit-config.yaml
.pre-commit-config.yaml
+15
-0
.pre-commit-hooks/cpplint.hook
.pre-commit-hooks/cpplint.hook
+60
-0
未找到文件。
.pre-commit-config.yaml
浏览文件 @
fb7cbb34
...
@@ -5,6 +5,7 @@ repos:
...
@@ -5,6 +5,7 @@ repos:
-
id
:
yapf
-
id
:
yapf
files
:
\.py$
files
:
\.py$
exclude
:
(?=third_party).*(\.py)$
exclude
:
(?=third_party).*(\.py)$
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
a11d9314b22d8f8c7556443875b731ef05965464
rev
:
a11d9314b22d8f8c7556443875b731ef05965464
hooks
:
hooks
:
...
@@ -31,6 +32,7 @@ repos:
...
@@ -31,6 +32,7 @@ repos:
-
--builtins=G,request
-
--builtins=G,request
-
--jobs=1
-
--jobs=1
exclude
:
(?=third_party).*(\.py)$
exclude
:
(?=third_party).*(\.py)$
-
repo
:
https://github.com/Lucas-C/pre-commit-hooks
-
repo
:
https://github.com/Lucas-C/pre-commit-hooks
rev
:
v1.0.1
rev
:
v1.0.1
hooks
:
hooks
:
...
@@ -42,6 +44,7 @@ repos:
...
@@ -42,6 +44,7 @@ repos:
files
:
\.md$
files
:
\.md$
-
id
:
remove-tabs
-
id
:
remove-tabs
files
:
\.md$
files
:
\.md$
-
repo
:
local
-
repo
:
local
hooks
:
hooks
:
-
id
:
clang-format
-
id
:
clang-format
...
@@ -51,14 +54,26 @@ repos:
...
@@ -51,14 +54,26 @@ repos:
language
:
system
language
:
system
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
exclude
:
(?=speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
exclude
:
(?=speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
#- id: copyright_checker
#- id: copyright_checker
# name: copyright_checker
# name: copyright_checker
# entry: python .pre-commit-hooks/copyright-check.hook
# entry: python .pre-commit-hooks/copyright-check.hook
# language: system
# language: system
# files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
# files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
# exclude: (?=third_party|pypinyin|speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
# exclude: (?=third_party|pypinyin|speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
-
repo
:
https://github.com/asottile/reorder_python_imports
-
repo
:
https://github.com/asottile/reorder_python_imports
rev
:
v2.4.0
rev
:
v2.4.0
hooks
:
hooks
:
-
id
:
reorder-python-imports
-
id
:
reorder-python-imports
exclude
:
(?=third_party).*(\.py)$
exclude
:
(?=third_party).*(\.py)$
-
repo
:
local
hooks
:
-
id
:
cpplint-cpp-source
name
:
cpplint
description
:
Check C++ code style using cpplint.py.
entry
:
bash .pre-commit-hooks/cpplint.hook
language
:
system
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
exclude
:
(?=speechx/speechx/kaldi|speechx/patch|speechx/tools/fstbin|speechx/tools/lmbin).*(\.cpp|\.cc|\.h|\.py)$
\ No newline at end of file
.pre-commit-hooks/cpplint.hook
0 → 100644
浏览文件 @
fb7cbb34
#!/bin/bash
#TOTAL_ERRORS=0
#echo "HAHAHAHAHHA"
#exit 5
#
#files=$(
#
#if [[ ! $TRAVIS_BRANCH ]]; then
# # install cpplint on local machine.
# if [[ ! $(which cpplint) ]]; then
# pip install cpplint
# fi
# # diff files on local machine.
# files=$(git diff --cached --name-status | awk 'Extra open brace or missing close brace2}')
#else
# # diff files between PR and latest commit on Travis CI.
# branch_ref=(gitrev−parse"TRAVIS_BRANCH")
# head_ref=$(git rev-parse HEAD)
# files=(gitdiff−−name−statusbranch_ref $head_ref | awk 'Extra open brace or missing close brace2}')
#fi
## The trick to remove deleted files: https://stackoverflow.com/a/2413151
#for file in $files; do
# echo $file
# if [[ $file =~ ^(patches/.*) ]]; then
# continue;
# else
# cpplint --filter=-readability/fn_size $file;
# TOTAL_ERRORS=(exprTOTAL_ERRORS + $?);
# fi
#done
#
#exit $TOTAL_ERRORS
if
git rev-parse
--verify
HEAD
>
/dev/null 2>&1
then
against
=
HEAD
else
# Initial commit: diff against an empty tree object
against
=
664cc9ca631283d0f38b8feb6b52b68152d0f63d
fi
# Redirect output to stderr.
exec
1>&2
cpplint
=
cpplint
sum
=
0
filters
=
'-build/include_order,-build/namespaces,-legal/copyright,-runtime/references,-build/include_what_you_use'
# for cpp
for
file
in
$(
git diff-index
--name-status
$against
--
|
grep
-E
'\.[ch](pp)?$'
|
awk
'{print $2}'
)
;
do
$cpplint
--filter
=
$filters
$file
sum
=
$(
expr
${
sum
}
+
$?
)
done
if
[
${
sum
}
-eq
0
]
;
then
exit
0
else
exit
1
fi
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录