Skip to content

Commit 360878e

Browse files
author
Bulat Shakirzyanov
committed
add a quick note on coding style
1 parent 9d200bc commit 360878e

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

.clang-format

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
BasedOnStyle: LLVM
2+
AlignAfterOpenBracket: true
3+
AlignConsecutiveAssignments: true
4+
AlignEscapedNewlinesLeft: true
5+
AlignOperands: true
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: true
8+
AllowShortBlocksOnASingleLine: false
9+
AllowShortCaseLabelsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: false
11+
AllowShortIfStatementsOnASingleLine: false
12+
AllowShortLoopsOnASingleLine: false
13+
AlwaysBreakAfterDefinitionReturnType: true
14+
AlwaysBreakBeforeMultilineStrings: true
15+
BinPackArguments: true
16+
BinPackParameters: false
17+
BreakBeforeBinaryOperators: NonAssignment
18+
BreakBeforeBraces: Linux
19+
BreakBeforeTernaryOperators: false
20+
BreakConstructorInitializersBeforeComma: true
21+
ColumnLimit: 0
22+
ContinuationIndentWidth: 2
23+
Cpp11BracedListStyle: false
24+
DerivePointerAlignment: false
25+
IndentCaseLabels: false
26+
IndentWidth: 2
27+
IndentWrappedFunctionNames: false
28+
KeepEmptyLinesAtTheStartOfBlocks: false
29+
MaxEmptyLinesToKeep: 1
30+
PointerAlignment: Left
31+
SpaceAfterCStyleCast: true
32+
SpaceBeforeAssignmentOperators: true
33+
SpaceBeforeParens: ControlStatements
34+
SpaceInEmptyParentheses: false
35+
SpacesBeforeTrailingComments: 1
36+
SpacesInCStyleCastParentheses: false
37+
SpacesInContainerLiterals: false
38+
SpacesInParentheses: false
39+
TabWidth: 2
40+
UseTab: Never

CONTRIBUTING.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@ help the maintainer to fix the bug that you've discovered quicker:
1313
* Write a failing test. The PHP Driver uses [PHPUnit test framework](https://phpunit.de/). A reliably
1414
failing test is the fastest way to demonstrate and fix a problem.
1515

16-
## Pull Requests
16+
## Pull requests
1717

1818
If you're able to fix a bug yourself, you can [fork the repository](https://help.github.com/articles/fork-a-repo/) and [submit a pull request](https://help.github.com/articles/using-pull-requests/) with the fix.
1919

2020
To protect DataStax and the community, all contributors are required to [sign the DataStax Contribution License Agreement](http://cla.datastax.com/). The process is completely electronic and should only take a few minutes.
21+
22+
## Style guide
23+
24+
There are 2 distinct coding styles used in the repository. Depending on which part of the codebase you're going to touch, you need to follow one or the other.
25+
26+
### PHP coding style
27+
28+
The API stubs provided by the extension are following [the Symfony 2 coding standard](http://symfony.com/doc/current/contributing/code/standards.html). The only exception are empty method stubs, those have opening and closing brace following the closing parenthesis on the same line.
29+
30+
### C coding style
31+
32+
The main difference here is the spacing, the C code uses 2 spaces for indendation, while the PHP code - 4. For your convenience, a `.clang-format` file is available in the repository's root directory. Using `clang-format`, you can format source files to match the coding style almost completely:
33+
34+
```bash
35+
clang-format -style=file -i ext/php_cassandra.c
36+
```

0 commit comments

Comments
 (0)