Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
cb4166c3
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cb4166c3
编写于
6月 19, 2020
作者:
L
liuxu
提交者:
GitHub
6月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DOCKER_DEV: add apollo_lint (#11501)
上级
82396742
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
84 addition
and
17 deletion
+84
-17
scripts/apollo_lint.sh
scripts/apollo_lint.sh
+84
-17
未找到文件。
scripts/apollo_lint.sh
浏览文件 @
cb4166c3
#! /usr/bin/env bash
set
-e
TOP_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/.."
&&
pwd
-P
)
"
source
"
${
TOP_DIR
}
/scripts/apollo.bashrc"
APOLLO_ROOT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/.."
&&
pwd
-P
)
"
source
"
${
APOLLO_ROOT_DIR
}
/scripts/apollo.bashrc"
TEST_CMD
=
"bazel test --distdir=
${
APOLLO_CACHE_DIR
}
"
function
check_pyflakes
()
{
# STAGE="${STAGE:-dev}"
:
${
STAGE
:
=dev
}
local
pyflakes_cmd
=
"
$(
command
-v
pyflakes
)
"
if
[
-z
"
${
pyflakes_cmd
}
"
]
;
then
sudo
-H
pip3
install
pyflakes
fi
function
cpp_lint
()
{
info
"running cpp_lint ..."
}
function
bash_lint
()
{
info
"running bash_lint ..."
function
check_shellcheck
()
{
local
shellcheck_cmd
=
"
$(
command
-v
shellcheck
)
"
if
[
-z
"
${
shellcheck_cmd
}
"
]
;
then
sudo
apt
install
shellcheck
fi
}
function
py_lint
()
{
info
"running py_lint ..."
function
run_cpp_lint
()
{
# Add cpplint rule to BUILD files that do not contain it.
for
file
in
$(
find cyber modules
-name
BUILD |
\
grep
-v
gnss/third_party |
grep
-v
modules/teleop/encoder/nvenc_sdk6 |
\
xargs
grep
-l
-E
'cc_library|cc_test|cc_binary'
| xargs
grep
-L
'cpplint()'
)
do
sed
-i
'1i\load("//tools:cpplint.bzl", "cpplint")\n'
$file
sed
-i
-e
'$a\\ncpplint()'
$file
done
BUILD_TARGETS
=
"
`
bazel query //modules/... except //modules/tools/visualizer/... union //cyber/...
`
"
${
TEST_CMD
}
--config
=
cpplint
-c
dbg
$BUILD_TARGETS
}
function
main
()
{
local
stage
=
"
${
STAGE
}
"
echo
"
$stage
"
cpp_lint
"
${
stage
}
"
bash_lint
"
${
stage
}
"
py_lint
"
${
stage
}
"
function
run_bash_lint
()
{
check_shellcheck
FILES
=
$(
find
"
${
APOLLO_ROOT_DIR
}
/cyber"
-type
f
-name
"*.sh"
|
grep
-v
ros
)
echo
"
${
FILES
}
"
| xargs shellcheck
}
main
"
$@
"
function
run_python_lint
()
{
check_pyflakes
find
${
APOLLO_ROOT_DIR
}
/modules
${
APOLLO_ROOT_DIR
}
/cyber
\
${
APOLLO_ROOT_DIR
}
/docker
\
${
APOLLO_ROOT_DIR
}
/tools
\
${
APOLLO_ROOT_DIR
}
/third_party
\
-type
f
-name
"*.py"
-exec
pyflakes
{}
\;
}
function
run_lint
()
{
local
cmd
=
$1
case
$cmd
in
python
)
run_python_lint
if
[
$?
-eq
0
]
;
then
success
'Python Lint passed!'
else
fail
'Python Lint failed!'
fi
;;
cpp
)
run_cpp_lint
if
[
$?
-eq
0
]
;
then
success
'CPP Lint passed!'
else
fail
'CPP Lint failed!'
fi
;;
shell
)
run_bash_lint
if
[
$?
-eq
0
]
;
then
success
'SHELL Lint passed!'
else
fail
'SHELL Lint failed!'
fi
;;
*
)
run_python_lint
run_cpp_lint
run_bash_lint
;;
esac
}
run_lint
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录