提交 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
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册