-
Notifications
You must be signed in to change notification settings - Fork 16
Document coding style #104
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Licensed under the Apache-2.0 license | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Documentation for this configuration is here: | ||
| # https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html | ||
|
|
||
| BasedOnStyle: Google | ||
| IndentWidth: 4 | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortLoopsOnASingleLine: false | ||
| DerivePointerAlignment: false | ||
| PointerAlignment: Right | ||
|
|
||
| IncludeCategories: | ||
| - # System Headers: #include <*> | ||
| Regex: '^<.*>$' | ||
| Priority: 1 | ||
| - # All Other Headers | ||
| Regex: '.*' | ||
| Priority: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Coding Style | ||
|
cfrantz marked this conversation as resolved.
|
||
|
|
||
| This document describes the coding style used by this project. | ||
| All of the formatters can be invoked by the `pw` utility script in the root of | ||
| the project: | ||
|
|
||
| ``` | ||
| $ ./pw format | ||
| ``` | ||
|
|
||
| ## Rust | ||
|
|
||
| This project follows the standard [Rust Style | ||
| Guide](https://doc.rust-lang.org/style-guide/) for Rust code. Formatting is | ||
| done with `rustfmt` using the | ||
| [`rustfmt.toml`](https://github.com/pigweed-project/pigweed/blob/main/rustfmt.toml) | ||
| from the upstream [Pigweed](https://github.com/pigweed-project/pigweed/) repository. | ||
|
|
||
| ## Python | ||
|
|
||
| This project follows [PEP8](https://peps.python.org/pep-0008/) for Python code. | ||
| Formatting is done with the `black` formatter. | ||
|
|
||
| ## Starlark (bazel build system) | ||
|
|
||
| This project follows the standard [bzl style | ||
| guide](https://bazel.build/rules/bzl-style) for Starlark code. | ||
| Formatting is done with the `buildifier` tool. | ||
|
|
||
| ## C / C++ | ||
|
|
||
| This project follows the [Google C++ Style Guide] for C and C++ code, with the | ||
| following exceptions: | ||
| - Indent is 4 spaces instead of 2. | ||
| - Function names should use `snake_case` instead of `PascalCase`. | ||
| - In pointer declarations, the asterisk is attached to the variable name (`int | ||
| *foo`) instead of the type name (`int* foo`). | ||
|
|
||
| Formatting is done with `clang-format`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.