Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle] upgrade pre-commit/pre-commit-hooks in .pre-commit-config.yaml #6239

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/ISSUE_TEMPLATE/1_documentation-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
attributes:
value: >
#### 请确认反馈的问题来自PaddlePaddle官网文档:https://www.paddlepaddle.org.cn/ 。
#### Before submitting a Documentation Issue, Please make sure that issue is related to https://www.paddlepaddle.org.cn/.
- type: textarea
Expand All @@ -28,16 +28,11 @@ body:
description: |
请告诉我们,你希望如何改进这个文档。
Please tell us how you would like to improve this document.
validations:
required: false

- type: markdown
attributes:
value: >
感谢你的贡献 🎉!Thanks for your contribution 🎉!
12 changes: 5 additions & 7 deletions .github/ISSUE_TEMPLATE/2_eval-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
attributes:
value: >
#### 此模板用于文档评估工作小组成员向飞桨团队反馈文档问题,如非工作小组成员,请使用「📚 文档」模板,感谢配合~
#### This template is used by members of the document evaluation working group to report documentation issues to the Paddle Team. If you are not a member of the working group, please use the "📚 Documentation Issue" template, thank you for your cooperation~
- type: textarea
Expand Down Expand Up @@ -38,11 +38,11 @@ body:
description: |
请评估本篇文档,是否按API文档推荐的结构书写,并且没有遗漏(无需写的部分可以省略)?
如有结构问题,请在以下文本框中说明。
API文档推荐的书写结构:API名称、API功能描述、API参数、API返回、API代码示例、API属性(class)、API方法(methods)
validations:
required: false

- type: textarea
id: eval3
attributes:
Expand All @@ -56,7 +56,7 @@ body:
- 没有死链、错字、错误标点等低级错误。
validations:
required: false

- type: textarea
id: eval4
attributes:
Expand All @@ -79,10 +79,8 @@ body:
如你已经发现了文档的错误并且判断其容易被修复,欢迎你为[Paddle](https://github.com/PaddlePaddle/Paddle/pulls)与[docs](https://github.com/PaddlePaddle/docs/pulls)提PR,直接修复此文档,并将PR链接贴在以下文本框中~
validations:
required: true

- type: markdown
attributes:
value: >
感谢你的贡献 🎉!Thanks for your contribution 🎉!
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ body:
- 其他
validations:
required: true

- type: markdown
attributes:
value: >
Expand All @@ -54,7 +54,7 @@ body:
attributes:
value: >
## 任务一体验评测
- type: textarea
id: distributed_dp_eval1
attributes:
Expand Down Expand Up @@ -111,7 +111,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_dp_eval5
attributes:
Expand All @@ -125,7 +125,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_dp_eval6
attributes:
Expand Down Expand Up @@ -191,7 +191,7 @@ body:
attributes:
value: >
## 任务二体验评测
- type: textarea
id: distributed_dp_eval11
attributes:
Expand Down Expand Up @@ -248,7 +248,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_dp_eval15
attributes:
Expand All @@ -262,7 +262,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_dp_eval16
attributes:
Expand Down Expand Up @@ -290,7 +290,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: false

- type: textarea
id: distributed_dp_eval18
attributes:
Expand All @@ -314,4 +314,3 @@ body:
attributes:
value: >
感谢你的贡献 🎉!Thanks for your contribution 🎉!
15 changes: 7 additions & 8 deletions .github/ISSUE_TEMPLATE/4_eval_distributed_PS_docs-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ body:
attributes:
value: >
## 任务一体验评测
- type: textarea
id: distributed_ps_eval1
attributes:
Expand Down Expand Up @@ -100,7 +100,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_ps_eval5
attributes:
Expand All @@ -114,7 +114,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_ps_eval6
attributes:
Expand All @@ -128,7 +128,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_ps_eval7
attributes:
Expand Down Expand Up @@ -167,7 +167,7 @@ body:
attributes:
value: >
## 任务二体验评测
- type: textarea
id: distributed_ps_eval11
attributes:
Expand Down Expand Up @@ -224,7 +224,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_ps_eval15
attributes:
Expand All @@ -238,7 +238,7 @@ body:
- 对应文档是否描述清晰(如不清晰,需注明问题并提供文档链接):
validations:
required: true

- type: textarea
id: distributed_ps_eval16
attributes:
Expand Down Expand Up @@ -276,4 +276,3 @@ body:
attributes:
value: >
感谢你的贡献 🎉!Thanks for your contribution 🎉!
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ build
.vscode
venv/

*.pyc
*.pyc
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ repos:
- id: black
files: \.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end-of-file-fixertrailing-whitespace 的 files 字段改成 types 吧,监控全部文本文件,即

     -   id: end-of-file-fixer
-        files: \.md$|\.rst$
+        types: [text]

hooks:
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
files: (?!.*paddle)^.*$
- id: end-of-file-fixer
files: \.md$|\.rst$
types: [text]
- id: trailing-whitespace
files: \.md$|\.rst$
types: [text]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
hooks:
Expand Down Expand Up @@ -43,4 +43,3 @@ repos:
entry: python .pre-commit-hooks/convert_markdown_into_html.py
language: system
files: .+README(\.cn)?\.md$

1 change: 0 additions & 1 deletion .pre-commit-hooks/convert_markdown_into_ipynb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ for file in $@ ; do
exit 1
fi
done

2 changes: 1 addition & 1 deletion ci_scripts/CAPItools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
robotpy-cppheaderparser==5.1.0
# paddle
# paddle
2 changes: 1 addition & 1 deletion ci_scripts/api_white_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ paddle/utils/cpp_extension/setup_cn.rst
paddle/utils/cpp_extension/CppExtension_cn.rst
paddle/utils/cpp_extension/CUDAExtension_cn.rst
paddle/hub/Overview_cn.rst
paddle/incubate/autograd/Overview_cn.rst
paddle/incubate/autograd/Overview_cn.rst
6 changes: 3 additions & 3 deletions ci_scripts/check_api_cn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ function filter_cn_api_files() {
local need_check_files=""
for file in `echo $git_files`;do
grep 'code-block:: python' ../docs/$file > /dev/null
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ] ;then
api_file=`echo $file | sed 's#api/##g'`
grep -w "${api_file}" ${DIR_PATH}/api_white_list.txt > /dev/null
if [ $? -ne 0 ];then
need_check_files="${need_check_files} $file"
fi
fi
fi
done
if [[ "$__resultvar" ]] ; then
Expand All @@ -40,4 +40,4 @@ python check_copy_from_parsed_into_sample_code.py "${OUTPUTDIR}/zh/${VERSIONSTR}
if [ $? -ne 0 ];then
echo "ERROR: Exist COPY-FROM has not been parsed into sample code, please check COPY-FROM in the above files"
exit 1
fi
fi
2 changes: 1 addition & 1 deletion ci_scripts/check_api_docs_en.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jsonfn=$1
output_path=$2
need_check_api_py_files="${3}"
echo "RUN System Message MARNING/ERROR Check"
check_system_message $jsonfn $output_path "${need_check_api_py_files}"
check_system_message $jsonfn $output_path "${need_check_api_py_files}"
2 changes: 1 addition & 1 deletion ci_scripts/check_api_label_cn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ python check_api_label_cn.py ${DOCROOT} ${APIROOT} $all_git_files
if [ $? -ne 0 ];then
echo "ERROR: api_label is not correct, please check api_label in the above files"
exit 1
fi
fi
2 changes: 1 addition & 1 deletion ci_scripts/check_api_parameters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function filter_cn_api_files() {
local need_check_files=""
for file in `echo $git_files`;do
echo "$file" | grep '.*\.rst$' > /dev/null
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ] ;then
need_check_files="${need_check_files} $file"
fi
done
Expand Down
1 change: 0 additions & 1 deletion ci_scripts/checkapproval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ for API_FILE in ${API_FILES[*]}; do
exit 1
fi
done

4 changes: 2 additions & 2 deletions ci_scripts/ci_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
export PADDLE_WHL
echo "PADDLE_WHL=${PADDLE_WHL}"
set -x

# 2 build all the Chinese and English docs, and upload them. Controlled with Env BUILD_DOC and UPLOAD_DOC
PREVIEW_URL_PROMPT="ipipe_log_param_preview_url: None"
if [ "${BUILD_DOC}" = "true" ] && [ -x /usr/local/bin/sphinx-build ] ; then
Expand All @@ -46,7 +46,7 @@ if [ "${BUILD_DOC}" = "true" ] && [ -x /usr/local/bin/sphinx-build ] ; then
if [ $? -ne 0 ];then
exit 1
fi

is_shell_attribute_set x
xdebug_setted=$?
if [ $xdebug_setted ] ; then
Expand Down
10 changes: 5 additions & 5 deletions ci_scripts/ci_start_en.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ echo "PADDLE_WHL=${PADDLE_WHL}"
# 2 build all the Chinese and English docs, and upload them. Controlled with Env BUILD_DOC and UPLOAD_DOC
PREVIEW_URL_PROMPT="ipipe_log_param_preview_url: None"
if [ "${BUILD_DOC}" = "true" ] && [ -x /usr/local/bin/sphinx-build ] ; then
apt update
apt install -y libpython3.7
apt update
apt install -y libpython3.7
apt --fix-broken install -y libssl1.0
/bin/bash -x ${DIR_PATH}/gendoc.sh
if [ $? -ne 0 ] ; then
exit 1
fi

is_shell_attribute_set x
xdebug_setted=$?
if [ $xdebug_setted ] ; then
Expand All @@ -67,7 +67,7 @@ if [ "${BUILD_DOC}" = "true" ] && [ -x /usr/local/bin/sphinx-build ] ; then
if [ $xdebug_setted ] ; then
set -x
fi

# https://cloud.baidu.com/doc/XLY/s/qjwvy89pc#%E7%B3%BB%E7%BB%9F%E5%8F%82%E6%95%B0%E5%A6%82%E4%B8%8B
# ${AGILE_PIPELINE_ID}-${AGILE_PIPELINE_BUILD_ID}"
if [ "${UPLOAD_DOC}" = "true" ] ; then
Expand Down Expand Up @@ -124,7 +124,7 @@ fi
if [ "${need_check_api_py_files}" = "" ] ; then
echo "api python file list is empty, skip check system message in docs"
else
echo 'need check api pyhon file: ', $need_check_api_py_files
echo 'need check api pyhon file: ', $need_check_api_py_files
/bin/bash ${DIR_PATH}/check_api_docs_en.sh ${jsonfn} ${OUTPUTDIR}/en/${VERSIONSTR}/api/ "${need_check_api_py_files}"
if [ $? -ne 0 ]; then
echo 'Docs Style Check is failed, please check the style in the above docs'
Expand Down
4 changes: 2 additions & 2 deletions ci_scripts/gendoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rm $tmp_fifofile # 清空管道内容

# for循环 往 fifo管道文件中写入$thread个空行
for ((i=0;i<$thread;i++));do
echo
echo
done >&6


Expand All @@ -54,7 +54,7 @@ for lang in en zh ; do
if [ "${lang}" = "zh" ] ; then
INDEXFILE="${OUTPUTDIR}/${lang}/${VERSIONSTR}/index_cn.html"
fi
if [ ! -f ${INDEXFILE} ] ; then
if [ ! -f ${INDEXFILE} ] ; then
/usr/local/bin/sphinx-build -b ${OUTPUTFORMAT} -j ${sphinx_thread} -d /var/doctrees -c ${CONFIGDIR}/${lang} ${DOCROOT} ${OUTPUTDIR}/${lang}/${VERSIONSTR}
fi

Expand Down
2 changes: 0 additions & 2 deletions ci_scripts/hooks/post-doc-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ VERSIONSTR=${2}
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"

python ${SCRIPT_DIR}/post_filter_htmls.py ${OUTPUTDIR}/en/${VERSIONSTR}/api/


Loading