提交 dcb3a9b8 编写于 作者: S sangoly 提交者: GitHub

[Pre-Commit] fix pre-commit hooks bug (#1844)

上级 0da398e6
...@@ -3,7 +3,8 @@ repos: ...@@ -3,7 +3,8 @@ repos:
sha: v1.0.1 sha: v1.0.1
hooks: hooks:
- id: remove-crlf - id: remove-crlf
files: (?!.*third_party)^.*$ | (?!.*book)^.*$ ^mobile/ ^metal/ ^web/ files: (?!.*third_party)^.*$|(?!.*book)^.*$
exclude: ^(mobile/|metal/|web/)
#- repo: https://github.com/PaddlePaddle/mirrors-yapf.git #- repo: https://github.com/PaddlePaddle/mirrors-yapf.git
#sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37 #sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
#hooks: #hooks:
...@@ -16,7 +17,7 @@ repos: ...@@ -16,7 +17,7 @@ repos:
- id: check-merge-conflict - id: check-merge-conflict
- id: check-symlinks - id: check-symlinks
- id: detect-private-key - id: detect-private-key
files: (?!.*third_party)^.*$ | (?!.*book)^.*$ files: (?!.*third_party)^.*$|(?!.*book)^.*$
- id: end-of-file-fixer - id: end-of-file-fixer
- repo: local - repo: local
hooks: hooks:
...@@ -25,7 +26,8 @@ repos: ...@@ -25,7 +26,8 @@ repos:
description: Format files with ClangFormat. description: Format files with ClangFormat.
entry: bash ./tools/codestyle/clang_format.hook -i entry: bash ./tools/codestyle/clang_format.hook -i
language: system language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$ ^mobile/ ^metal/ ^web/ files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$
exclude: ^(mobile/|metal/|web/)
- repo: local - repo: local
hooks: hooks:
- id: cpplint-cpp-source - id: cpplint-cpp-source
...@@ -33,7 +35,8 @@ repos: ...@@ -33,7 +35,8 @@ repos:
description: Check C++ code style using cpplint.py. description: Check C++ code style using cpplint.py.
entry: bash ./tools/codestyle/cpplint_pre_commit.hook entry: bash ./tools/codestyle/cpplint_pre_commit.hook
language: system language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$ ^mobile/ ^metal/ ^web/ files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
exclude: ^(mobile/|metal/|web/)
#- repo: local #- repo: local
#hooks: #hooks:
#- id: pylint-doc-string #- id: pylint-doc-string
...@@ -48,5 +51,6 @@ repos: ...@@ -48,5 +51,6 @@ repos:
name: copyright_checker name: copyright_checker
entry: python ./tools/codestyle/copyright.hook entry: python ./tools/codestyle/copyright.hook
language: system language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$ ^mobile/ ^metal/ ^web/ files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$ exclude: (?!.*third_party)^.*$|(?!.*book)^.*$
exclude: ^(mobile/|metal/|web/)
...@@ -9,18 +9,17 @@ os: ...@@ -9,18 +9,17 @@ os:
addons: addons:
apt: apt:
packages: packages:
- git # - git
- python # - python
- python-pip # - python-pip
- python2.7-dev # - python2.7-dev
- libc6-i386 # - libc6-i386
- curl # - curl
- clang-format-3.8
compiler:
- clang
before_install: before_install:
- sudo pip install -U virtualenv pre-commit pip - sudo pip install cpplint pre-commit
- sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format
# Download and install recent cmake # Download and install recent cmake
script: script:
......
...@@ -11,6 +11,8 @@ cd `dirname $0` ...@@ -11,6 +11,8 @@ cd `dirname $0`
cd .. cd ..
export PATH=/usr/bin:$PATH export PATH=/usr/bin:$PATH
pre-commit install pre-commit install
which clang-format
clang-format --version
if ! pre-commit run -a ; then if ! pre-commit run -a ; then
ls -lh ls -lh
......
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS=
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto init
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto init
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
set CMD_LINE_ARGS= set CMD_LINE_ARGS=
set _SKIP=2 set _SKIP=2
:win9xME_args_slurp :win9xME_args_slurp
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1 exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega
...@@ -115,7 +115,7 @@ void FillTensorData(lite::Tensor* tensor, const DebugConfig& conf, int col) { ...@@ -115,7 +115,7 @@ void FillTensorData(lite::Tensor* tensor, const DebugConfig& conf, int col) {
data[i] = input_data[i]; data[i] = input_data[i];
} }
} else { } else {
LOG(INFO) << "------------> Use all-ones input"; LOG(INFO) << "-------------> Use all-ones input";
for (int i = 0; i < dim_size; i++) { for (int i = 0; i < dim_size; i++) {
data[i] = 1; data[i] = 1;
} }
......
...@@ -35,7 +35,7 @@ static bool IsFileExists(const std::string& path) { ...@@ -35,7 +35,7 @@ static bool IsFileExists(const std::string& path) {
// ARM mobile not support mkdir in C++ // ARM mobile not support mkdir in C++
static void MkDirRecur(const std::string& path) { static void MkDirRecur(const std::string& path) {
#ifndef LITE_WITH_ARM #ifndef LITE_WITH_ARM
if(system(string_format("mkdir -p %s", path.c_str()).c_str()) != 0) { if (system(string_format("mkdir -p %s", path.c_str()).c_str()) != 0) {
LOG(ERROR) << "Cann't mkdir " << path; LOG(ERROR) << "Cann't mkdir " << path;
} }
#else // On ARM #else // On ARM
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册