From 19b4ff47818c492cd40977a3d0fc044c6830790c Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90code=20format=20check=20upgrade?= =?UTF-8?q?=E3=80=91=20step1=EF=BC=9Acpplint=20(#43175)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test=document_fix * cpplint set version 1.6.0;test=document_fix --- tools/codestyle/cpplint_pre_commit.hook | 9 +++++++-- tools/codestyle/pylint_pre_commit.hook | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/codestyle/cpplint_pre_commit.hook b/tools/codestyle/cpplint_pre_commit.hook index c90bf29ecb7..cef11ab1351 100755 --- a/tools/codestyle/cpplint_pre_commit.hook +++ b/tools/codestyle/cpplint_pre_commit.hook @@ -1,10 +1,15 @@ #!/bin/bash TOTAL_ERRORS=0 + +readonly VERSION="1.6.0" + +version=$(cpplint --version) + if [[ ! $TRAVIS_BRANCH ]]; then # install cpplint on local machine. - if [[ ! $(which cpplint) ]]; then - pip install cpplint + if ! [[ $version == *"$VERSION"* ]]; then + pip install cpplint==1.6.0 fi # diff files on local machine. files=$(git diff --cached --name-status | awk '$1 != "D" {print $2}') diff --git a/tools/codestyle/pylint_pre_commit.hook b/tools/codestyle/pylint_pre_commit.hook index f0d2f0a22d7..1c81f4b4563 100755 --- a/tools/codestyle/pylint_pre_commit.hook +++ b/tools/codestyle/pylint_pre_commit.hook @@ -10,7 +10,7 @@ readonly VERSION="2.12.0" version=$(pylint --version | grep 'pylint') if ! [[ $version == *"$VERSION"* ]]; then - pip install pylint==2.12.0 1>nul + pip install pylint==2.12.0 fi # The trick to remove deleted files: https://stackoverflow.com/a/2413151 -- GitLab