Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ci/scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ print_help() {
echo " -s, --only-staged Only format staged files"
echo " -v, --verbose Enable verbose output"
echo " -h, --help Show this help message"
echo ""
echo "Uses the following clang-format style:"
echo " { $(echo "${clang_style}" | sed 's/[{}]//g; s/, */;\n /g')" }
echo ""
echo "Formats files with the following extensions: ${extensions_to_style_check}"
echo "in the following directories:"
echo " ${dirs_to_style_check}" | fold -s -w 80 | sed '2,$s/^/ /'
echo ""
echo "Examples:"
echo " Format changes against upstream/main (useful before opening a PR to upstream/main):"
echo " $0 -b upstream/main"
echo ""
echo " Check format for staged changes against HEAD (useful for a pre-commit hook):"
echo " $0 --dry-run --only-staged --compare-base $(git rev-parse --short HEAD)"
}

while [[ $# -gt 0 ]]; do
Expand Down
10 changes: 3 additions & 7 deletions docs/pages/overview/contrib.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ Please submit a pull request! We welcome code and idea contributions.

### Indentation, etc.

Comdb2 contains code from multiple open source libraries. If editing existing code for, for example, BerkeleyDB and
SQLite, please stick to existing conventions for those code bases. For Comdb2 code, it's highly recommended that
before you creating a pull request, please format your code with `clang` via the following:

```
clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4, UseTab: Never, BreakBeforeBraces: Linux, SortIncludes: false, IndentCaseLabels: false, AlwaysBreakTemplateDeclarations: true, AllowShortFunctionsOnASingleLine: false, AllowShortCaseLabelsOnASingleLine: true, AllowShortIfStatementsOnASingleLine: true}"
```
Comdb2 contains code from multiple open source libraries. If editing existing code for, for example, BerkeleyDB and
SQLite, please stick to existing conventions for those code bases. For Comdb2 code, you can check your formatting
using the `ci/scripts/format` script. Run `./ci/scripts/format -h` for details.

### Producing trace

Expand Down