Skip to content

Commit 0f97364

Browse files
committed
Update formatting docs
Signed-off-by: mdouglas47 <mdouglas47@bloomberg.net>
1 parent c3ab0ad commit 0f97364

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

ci/scripts/format

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ print_help() {
5252
echo " -s, --only-staged Only format staged files"
5353
echo " -v, --verbose Enable verbose output"
5454
echo " -h, --help Show this help message"
55+
echo ""
56+
echo "Uses the following clang-format style:"
57+
echo " { $(echo "${clang_style}" | sed 's/[{}]//g; s/, */;\n /g')" }
58+
echo ""
59+
echo "Formats files with the following extensions: ${extensions_to_style_check}"
60+
echo "in the following directories:"
61+
echo " ${dirs_to_style_check}" | fold -s -w 80 | sed '2,$s/^/ /'
62+
echo ""
63+
echo "Examples:"
64+
echo " Format changes against upstream/main (useful before opening a PR to upstream/main):"
65+
echo " $0 -b upstream/main"
66+
echo ""
67+
echo " Check format for staged changes against HEAD (useful for a pre-commit hook):"
68+
echo " $0 --dry-run --only-staged --compare-base $(git rev-parse --short HEAD)"
5569
}
5670

5771
while [[ $# -gt 0 ]]; do

docs/pages/overview/contrib.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ Please submit a pull request! We welcome code and idea contributions.
1010

1111
### Indentation, etc.
1212

13-
Comdb2 contains code from multiple open source libraries. If editing existing code for, for example, BerkeleyDB and
14-
SQLite, please stick to existing conventions for those code bases. For Comdb2 code, it's highly recommended that
15-
before you creating a pull request, please format your code with `clang` via the following:
16-
17-
```
18-
clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4, UseTab: Never, BreakBeforeBraces: Linux, SortIncludes: false, IndentCaseLabels: false, AlwaysBreakTemplateDeclarations: true, AllowShortFunctionsOnASingleLine: false, AllowShortCaseLabelsOnASingleLine: true, AllowShortIfStatementsOnASingleLine: true}"
19-
```
13+
Comdb2 contains code from multiple open source libraries. If editing existing code for, for example, BerkeleyDB and
14+
SQLite, please stick to existing conventions for those code bases. For Comdb2 code, you can check your formatting
15+
using the `ci/scripts/format` script. Run `./ci/scripts/format -h` for details.
2016

2117
### Producing trace
2218

0 commit comments

Comments
 (0)