qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit 7458ac94897afa7f67d98bc40aa1e090c11c235d
parent cfa9f6ba6da7e6d3435610d6d3b4b7971d3dd547
Author: Drashna Jaelre <drashna@live.com>
Date:   Sat,  6 Oct 2018 17:43:37 -0700

Update Contrib doc (#4068)

* Add link for style

* ignore java

* Add example and update link?

* Minor fixes

* Change 1TBS text

* comments

Diffstat:
docs/contributing.md | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/docs/contributing.md b/docs/contributing.md @@ -57,14 +57,14 @@ Never made an open source contribution before? Wondering how contributions work Most of our style is pretty easy to pick up on, but right now it's not entirely consistent. You should match the style of the code surrounding your change, but if that code is inconsistent or unclear use the following guidelines: * We indent using two spaces (soft tabs) -* We use One True Brace Style +* We use a modified One True Brace Style * Opening Brace: At the end of the same line as the statement that opens the block * Closing Brace: Lined up with the first character of the statement that opens the block * Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line. * Optional Braces: Always include optional braces. * Good: if (condition) { return false; } * Bad: if (condition) return false; -* We use C style comments: `/* */` +* We encourage use of C style comments: `/* */` * Think of them as a story describing the feature * Use them liberally to explain why particular decisions were made. * Do not write obvious comments @@ -72,6 +72,25 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely * In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns. * We use `#pragma once` at the start of header files rather than old-style include guards (`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`) +Here is an example for easy reference: + +```c +/* Enums for foo */ +enum foo_state { + FOO_BAR, + FOO_BAZ, +}; + +/* Returns a value */ +int foo(void) { + if (some_condition) { + return FOO_BAR; + } else { + return -1; + } +} +``` + # General Guidelines We have a few different types of changes in QMK, each requiring a different level of rigor. We'd like you to keep the following guidelines in mind no matter what type of change you're making.