Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
662fa999
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
662fa999
编写于
8月 14, 2023
作者:
W
Wang Xin
提交者:
GitHub
8月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[clang-tidy] skip check when not find compilation db (#56134)
上级
0f5148fb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
3 deletion
+12
-3
tools/codestyle/clang-tidy.py
tools/codestyle/clang-tidy.py
+12
-3
未找到文件。
tools/codestyle/clang-tidy.py
浏览文件 @
662fa999
...
@@ -75,18 +75,19 @@ else:
...
@@ -75,18 +75,19 @@ else:
import
queue
import
queue
def
find_compilation_database
(
path
):
def
find_compilation_database
(
path
,
result
=
"./"
):
"""Adjusts the directory until a compilation database is found."""
"""Adjusts the directory until a compilation database is found."""
result
=
'./'
result
=
'./'
while
not
os
.
path
.
isfile
(
os
.
path
.
join
(
result
,
path
)):
while
not
os
.
path
.
isfile
(
os
.
path
.
join
(
result
,
path
)):
if
os
.
path
.
realpath
(
result
)
==
'/'
:
if
os
.
path
.
realpath
(
result
)
==
'/'
:
print
(
'
Error
: could not find compilation database.'
)
print
(
'
Warning
: could not find compilation database.'
)
sys
.
exit
(
1
)
return
None
result
+=
'../'
result
+=
'../'
return
os
.
path
.
realpath
(
result
)
return
os
.
path
.
realpath
(
result
)
def
make_absolute
(
f
,
directory
):
def
make_absolute
(
f
,
directory
):
"""Convert a relative file path to an absolute file path."""
if
os
.
path
.
isabs
(
f
):
if
os
.
path
.
isabs
(
f
):
return
f
return
f
return
os
.
path
.
normpath
(
os
.
path
.
join
(
directory
,
f
))
return
os
.
path
.
normpath
(
os
.
path
.
join
(
directory
,
f
))
...
@@ -216,6 +217,7 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
...
@@ -216,6 +217,7 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
def
main
():
def
main
():
"""Runs clang-tidy over all files in a compilation database."""
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
description
=
'Runs clang-tidy over all files '
description
=
'Runs clang-tidy over all files '
'in a compilation database. Requires '
'in a compilation database. Requires '
...
@@ -317,9 +319,16 @@ def main():
...
@@ -317,9 +319,16 @@ def main():
if
args
.
build_path
is
not
None
:
if
args
.
build_path
is
not
None
:
build_path
=
args
.
build_path
build_path
=
args
.
build_path
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
build_path
,
db_path
)):
print
(
f
'Warning: could not find compilation database in
{
build_path
}
, skip clang-tidy check.'
)
build_path
=
None
else
:
else
:
# Find our database
# Find our database
build_path
=
find_compilation_database
(
db_path
)
build_path
=
find_compilation_database
(
db_path
)
if
build_path
is
None
:
sys
.
exit
(
0
)
try
:
try
:
invocation
=
[
args
.
clang_tidy_binary
,
'-list-checks'
]
invocation
=
[
args
.
clang_tidy_binary
,
'-list-checks'
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录