-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from kuke/add_clang-format_hook
Add clang-format hook
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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 | ||
MaxEmptyLinesToKeep: 2 | ||
AccessModifierOffset: -2 # The private/protected/public has no indent in class | ||
Standard: Cpp11 | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
BinPackParameters: false | ||
BinPackArguments: false | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# clang-format hook without version check | ||
|
||
clang-format $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters