From e0e47bdf547cc0e63c6c534d1c4225274e7d9d0a Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Mon, 10 Jun 2019 12:37:00 +0000 Subject: [PATCH] add files --- .clang-format | 27 +++++++++++++++++++++ .dockerignore | 15 ++++++++++++ .gitignore | 36 ++++++++++++++++++++++++++++ .pre-commit-config.yaml | 52 +++++++++++++++++++++++++++++++++++++++++ .style.yapf | 3 +++ .travis.yml | 30 ++++++++++++++++++++++++ 6 files changed, 163 insertions(+) create mode 100644 .clang-format create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 .style.yapf create mode 100644 .travis.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..8b583062734 --- /dev/null +++ b/.clang-format @@ -0,0 +1,27 @@ +# This file is used by clang-format to autoformat paddle source code +# +# The clang-format is part of llvm toolchain. +# It need to install llvm and clang to format source code style. +# +# The basic usage is, +# clang-format -i -style=file PATH/TO/SOURCE/CODE +# +# The -style=file implicit use ".clang-format" file located in one of +# parent directory. +# The -i means inplace change. +# +# The document of clang-format is +# http://clang.llvm.org/docs/ClangFormat.html +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html +--- +Language: Cpp +BasedOnStyle: Google +IndentWidth: 2 +TabWidth: 2 +ContinuationIndentWidth: 4 +AccessModifierOffset: -1 # The private/protected/public has no indent in class +Standard: Cpp11 +AllowAllParametersOfDeclarationOnNextLine: true +BinPackParameters: false +BinPackArguments: false +... diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..2b2e74053d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +*.DS_Store +build/ +*.user +.vscode +.idea +.project +.cproject +.pydevproject +Makefile +.test_env/ +third_party/ +*~ +bazel-* + +!build/*.deb diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..865ae6c5032 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +python/paddle/fluid/tests/unittests/reader_reset_test.recordio +paddle/operators/check_t.save +paddle/operators/check_tensor.ls +paddle/operators/tensor.save +python/paddle/v2/fluid/tests/book/image_classification_resnet.inference.model/ +python/paddle/v2/fluid/tests/book/image_classification_vgg.inference.model/ +python/paddle/v2/fluid/tests/book/label_semantic_roles.inference.model/ +paddle/fluid/operators/distributed/send_recv.proto +*.DS_Store +*.vs +build/ +build_doc/ +*.user +*.sh +*.bkp + +.vscode +.idea +.project +.cproject +.pydevproject +.settings/ +CMakeSettings.json +Makefile +.test_env/ +third_party/ + +*~ +bazel-* +third_party/ + +build_* +# clion workspace. +cmake-build-* +paddle/fluid/operators/distributed/send_recv.proto +model_test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..d8112837dc9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,52 @@ +repos: +- repo: https://github.com/Lucas-C/pre-commit-hooks.git + sha: v1.0.1 + hooks: + - id: remove-crlf + files: (?!.*third_party)^.*$ | (?!.*book)^.*$ +- repo: https://github.com/PaddlePaddle/mirrors-yapf.git + sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37 + hooks: + - id: yapf + files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$ +- repo: https://github.com/pre-commit/pre-commit-hooks + sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0 + hooks: + - id: check-added-large-files + - id: check-merge-conflict + - id: check-symlinks + - id: detect-private-key + files: (?!.*third_party)^.*$ | (?!.*book)^.*$ + - id: end-of-file-fixer +- repo: local + hooks: + - id: clang-format-with-version-check + name: clang-format + description: Format files with ClangFormat. + entry: bash ./tools/codestyle/clang_format.hook -i + language: system + files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$ +- repo: local + hooks: + - id: cpplint-cpp-source + name: cpplint + description: Check C++ code style using cpplint.py. + entry: bash ./tools/codestyle/cpplint_pre_commit.hook + language: system + files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$ +- repo: local + hooks: + - id: pylint-doc-string + name: pylint + description: Check python docstring style using docstring_checker. + entry: bash ./tools/codestyle/pylint_pre_commit.hook + language: system + files: \.(py)$ +- repo: local + hooks: + - id: copyright_checker + name: copyright_checker + entry: python ./tools/codestyle/copyright.hook + language: system + files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$ + exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$ diff --git a/.style.yapf b/.style.yapf new file mode 100644 index 00000000000..4741fb4f3bb --- /dev/null +++ b/.style.yapf @@ -0,0 +1,3 @@ +[style] +based_on_style = pep8 +column_limit = 80 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..87de895ddad --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: cpp +cache: + directories: + - $HOME/.ccache + - $HOME/.cache/pip + - $TRAVIS_BUILD_DIR/build/third_party +sudo: required +dist: trusty +services: + - docker +os: + - linux +env: + - JOB=check_style +addons: + ssh_known_hosts: 13.229.163.131 +before_install: + # For pylint dockstring checker + - sudo pip install pylint pytest astroid isort + - | + function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } +script: + - | + # 43min timeout + paddle/scripts/paddle_docker_build.sh ${JOB} + if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi; +notifications: + email: + on_success: change + on_failure: always -- GitLab