Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c67cb619
Unverified
Commit
c67cb619
authored
Mar 02, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CODING_STYLE: clang-format
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0c9119fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
CODING_STYLE.md
CODING_STYLE.md
+44
-0
No files found.
CODING_STYLE.md
View file @
c67cb619
...
@@ -16,6 +16,50 @@
...
@@ -16,6 +16,50 @@
style and add their Signed-off-by line to it. This is especially helpful to
style and add their Signed-off-by line to it. This is especially helpful to
make it easier for first-time contributors and to prevent having pull
make it easier for first-time contributors and to prevent having pull
requests being stuck in the merge queue because of minor details.
requests being stuck in the merge queue because of minor details.
-
We currently do not provide automatic coding style checks but if a suitable
tool is found we are happy to integrate it into our test suite. It is
possible and recommended to use the
`clang-format`
binary to check your code.
The following options are an approximation of the coding style used here.
Simply create a file called
`.clang-format`
in your home directory with the
following options:
```sh
cat << EOF > "${HOME}"/.clang-format
BreakBeforeBraces: Attach
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
MaxEmptyLinesToKeep: 1
PenaltyBreakBeforeFirstCallParameter: 1000000
BinPackArguments: true
BinPackParameters: true
AllowAllParametersOfDeclarationOnNextLine: false
AlignAfterOpenBracket: true
SpacesInSquareBrackets: false
SpacesInCStyleCastParentheses: false
SpaceInEmptyParentheses: false
SpaceBeforeParens: ControlStatements
SpaceAfterCStyleCast: false
SortIncludes: true
PenaltyReturnTypeOnItsOwnLine: 10000
PenaltyExcessCharacter: 10
Language: Cpp
ForEachMacros: ['lxc_list_for_each', 'lxc_list_for_each_safe']
AllowShortLoopsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortCaseLabelsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
BasedOnStyle: LLVM
TabWidth: 8
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
EOF
```
However, it will not handle all cases correctly. For example, most
`struct`
initializations will not be correct. In such cases please refer to the coding
style here.
#### Only Use Tabs
#### Only Use Tabs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment