Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
bf1320a7
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bf1320a7
编写于
4月 26, 2017
作者:
X
xuwei06
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skip cpplint if source is not changed.
Change-Id: Ia29cd3d205e401dc3d04fbaf3cba2b01f2f4f0ca
上级
32a5d760
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
5 deletion
+19
-5
cmake/cpplint.cmake
cmake/cpplint.cmake
+8
-4
paddle/scripts/cpplint.py
paddle/scripts/cpplint.py
+11
-1
未找到文件。
cmake/cpplint.cmake
浏览文件 @
bf1320a7
...
@@ -34,7 +34,7 @@ set(IGNORE_PATTERN
...
@@ -34,7 +34,7 @@ set(IGNORE_PATTERN
#
#
# first argument: target name to attach
# first argument: target name to attach
# rest arguments: source list to check code style.
# rest arguments: source list to check code style.
#
#
# NOTE: If WITH_STYLE_CHECK is OFF, then this macro just do nothing.
# NOTE: If WITH_STYLE_CHECK is OFF, then this macro just do nothing.
macro
(
add_style_check_target TARGET_NAME
)
macro
(
add_style_check_target TARGET_NAME
)
if
(
WITH_STYLE_CHECK
)
if
(
WITH_STYLE_CHECK
)
...
@@ -48,13 +48,17 @@ macro(add_style_check_target TARGET_NAME)
...
@@ -48,13 +48,17 @@ macro(add_style_check_target TARGET_NAME)
if
(
filename MATCHES
${
pattern
}
)
if
(
filename MATCHES
${
pattern
}
)
message
(
STATUS
"DROP LINT
${
filename
}
"
)
message
(
STATUS
"DROP LINT
${
filename
}
"
)
set
(
LINT OFF
)
set
(
LINT OFF
)
endif
()
endif
()
endforeach
()
endforeach
()
if
(
LINT MATCHES ON
)
if
(
LINT MATCHES ON
)
add_custom_command
(
TARGET
${
TARGET_NAME
}
get_filename_component
(
base_filename
${
filename
}
NAME
)
set
(
CUR_GEN
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
base_filename
}
.cpplint
)
add_custom_command
(
OUTPUT
${
CUR_GEN
}
PRE_BUILD
PRE_BUILD
COMMAND env
${
py_env
}
"
${
PYTHON_EXECUTABLE
}
"
"
${
PROJ_ROOT
}
/paddle/scripts/cpplint.py"
COMMAND env
${
py_env
}
"
${
PYTHON_EXECUTABLE
}
"
"
${
PROJ_ROOT
}
/paddle/scripts/cpplint.py"
"--filter=
${
STYLE_FILTER
}
"
${
filename
}
"--filter=
${
STYLE_FILTER
}
"
"--write-success=
${
CUR_GEN
}
"
${
filename
}
DEPENDS
${
filename
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_LIST_DIR
}
)
WORKING_DIRECTORY
${
CMAKE_CURRENT_LIST_DIR
}
)
endif
()
endif
()
endforeach
()
endforeach
()
...
...
paddle/scripts/cpplint.py
浏览文件 @
bf1320a7
...
@@ -58,6 +58,7 @@ _USAGE = """
...
@@ -58,6 +58,7 @@ _USAGE = """
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
[--counting=total|toplevel|detailed] [--root=subdir]
[--counting=total|toplevel|detailed] [--root=subdir]
[--linelength=digits]
[--linelength=digits]
[--write-success=success_status_file]
<file> [file] ...
<file> [file] ...
The style guidelines this tries to follow are those in
The style guidelines this tries to follow are those in
...
@@ -499,6 +500,8 @@ _line_length = 80
...
@@ -499,6 +500,8 @@ _line_length = 80
# This is set by --extensions flag.
# This is set by --extensions flag.
_valid_extensions
=
set
([
'cc'
,
'h'
,
'cpp'
,
'cu'
,
'cuh'
])
_valid_extensions
=
set
([
'cc'
,
'h'
,
'cpp'
,
'cu'
,
'cuh'
])
_write_success
=
None
def
ParseNolintSuppressions
(
filename
,
raw_line
,
linenum
,
error
):
def
ParseNolintSuppressions
(
filename
,
raw_line
,
linenum
,
error
):
"""Updates the global list of error-suppressions.
"""Updates the global list of error-suppressions.
...
@@ -6337,7 +6340,7 @@ def ParseArguments(args):
...
@@ -6337,7 +6340,7 @@ def ParseArguments(args):
try
:
try
:
(
opts
,
filenames
)
=
getopt
.
getopt
(
args
,
''
,
[
(
opts
,
filenames
)
=
getopt
.
getopt
(
args
,
''
,
[
'help'
,
'output='
,
'verbose='
,
'counting='
,
'filter='
,
'root='
,
'help'
,
'output='
,
'verbose='
,
'counting='
,
'filter='
,
'root='
,
'linelength='
,
'extensions='
'linelength='
,
'extensions='
,
'write-success='
])
])
except
getopt
.
GetoptError
:
except
getopt
.
GetoptError
:
PrintUsage
(
'Invalid arguments.'
)
PrintUsage
(
'Invalid arguments.'
)
...
@@ -6382,6 +6385,9 @@ def ParseArguments(args):
...
@@ -6382,6 +6385,9 @@ def ParseArguments(args):
_valid_extensions
=
set
(
val
.
split
(
','
))
_valid_extensions
=
set
(
val
.
split
(
','
))
except
ValueError
:
except
ValueError
:
PrintUsage
(
'Extensions must be comma seperated list.'
)
PrintUsage
(
'Extensions must be comma seperated list.'
)
elif
opt
==
'--write-success'
:
global
_write_success
_write_success
=
val
if
not
filenames
:
if
not
filenames
:
PrintUsage
(
'No files were specified.'
)
PrintUsage
(
'No files were specified.'
)
...
@@ -6408,6 +6414,10 @@ def main():
...
@@ -6408,6 +6414,10 @@ def main():
ProcessFile
(
filename
,
_cpplint_state
.
verbose_level
)
ProcessFile
(
filename
,
_cpplint_state
.
verbose_level
)
_cpplint_state
.
PrintErrorCounts
()
_cpplint_state
.
PrintErrorCounts
()
if
_cpplint_state
.
error_count
==
0
and
_write_success
is
not
None
:
with
open
(
_write_success
,
'a'
):
os
.
utime
(
_write_success
,
None
)
sys
.
exit
(
_cpplint_state
.
error_count
>
0
)
sys
.
exit
(
_cpplint_state
.
error_count
>
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录