未验证 提交 664758fa 编写于 作者: S Sing_chan 提交者: GitHub

code format check upgrade step1: pre-commit, remove-ctrlf, pylint (#43103)

上级 f59bcb1c
repos: repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks.git - repo: https://github.com/Lucas-C/pre-commit-hooks.git
sha: v1.0.1 rev: v1.1.14
hooks: hooks:
- id: remove-crlf - id: remove-crlf
files: (?!.*third_party)^.*$ | (?!.*book)^.*$ files: (?!.*third_party)^.*$ | (?!.*book)^.*$
......
...@@ -360,6 +360,10 @@ function check_style() { ...@@ -360,6 +360,10 @@ function check_style() {
# pre-commit use python3.8.0 # pre-commit use python3.8.0
OLD_PATH=$PATH OLD_PATH=$PATH
export PATH=/usr/local/python3.8.0/bin:/usr/local/python3.8.0/include:/usr/local/bin:${PATH} export PATH=/usr/local/python3.8.0/bin:/usr/local/python3.8.0/include:/usr/local/bin:${PATH}
if ! [[ $(pre-commit --version) == *"2.17.0"* ]]; then
pip install pre-commit==2.17.0
fi
pre-commit install pre-commit install
clang-format --version clang-format --version
......
...@@ -6,6 +6,13 @@ TOTAL_ERRORS=0 ...@@ -6,6 +6,13 @@ TOTAL_ERRORS=0
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PYTHONPATH=$DIR:$PYTHONPATH export PYTHONPATH=$DIR:$PYTHONPATH
readonly VERSION="2.12.0"
version=$(pylint --version | grep 'pylint')
if ! [[ $version == *"$VERSION"* ]]; then
pip install pylint==2.12.0 1>nul
fi
# The trick to remove deleted files: https://stackoverflow.com/a/2413151 # The trick to remove deleted files: https://stackoverflow.com/a/2413151
for file in $(git diff --name-status | awk '$1 != "D" {print $2}'); do for file in $(git diff --name-status | awk '$1 != "D" {print $2}'); do
pylint --disable=all --load-plugins=docstring_checker \ pylint --disable=all --load-plugins=docstring_checker \
...@@ -16,4 +23,3 @@ done ...@@ -16,4 +23,3 @@ done
exit $TOTAL_ERRORS exit $TOTAL_ERRORS
#For now, just warning: #For now, just warning:
#exit 0 #exit 0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册