Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contributing: update to reference single line braces #247

Merged
merged 3 commits into from
Dec 19, 2022
Merged
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
33 changes: 27 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ Use GitHub Pull requests to change CNDP.

C code should follow the CNDP coding standards.

A .clang-format is available in the CNDP repo and can be run with ninja or a
pre-commit hook is available and can be used to apply the clang format to
A .clang-format file is available in the CNDP repo and can be run with ninja:

``` bash
ninja -C builddir clang-format
```

Or with git-clang-format if it is installed:

``` bash
git clang-format --diff
```

Or a pre-commit hook is available and can be used to apply the clang format to
modified files in a commit by doing the following before committing changes:

``` bash
$ cp .githooks/pre-commit .git/hooks/
$ chmod +x .git/hooks/pre-commit
cp .githooks/pre-commit .git/hooks/
chmod +x .git/hooks/pre-commit
```

Guidelines for public or private APIs is to hide as much of the internal API
Expand Down Expand Up @@ -87,8 +98,18 @@ int foobar(foo_t *foo) {
Naming header files as xyz\_private.h and cne\_xyz.h is preferred. The .c files should be named
xyz.c or cne\_xyz.c.

### Braces for single line statements
Do not use braces where a single statement (if, while, for, ...) will do:

``` c
if (foo)
do_this();
else
do_that();
```

## Maintainers

The CNDP maintainers are as follows:
* Jeff Shaw
* Keith Wiles
* Jeff Shaw
* Keith Wiles