summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-10-06 17:43:37 -0700
committerJack Humbert <jack.humb@gmail.com>2018-10-06 20:43:37 -0400
commit7458ac94897afa7f67d98bc40aa1e090c11c235d (patch)
tree1eafa3303badb583b292155ec9182cede7752a70 /docs
parentcfa9f6ba6da7e6d3435610d6d3b4b7971d3dd547 (diff)
Update Contrib doc (#4068)
* Add link for style * ignore java * Add example and update link? * Minor fixes * Change 1TBS text * comments
Diffstat (limited to 'docs')
-rw-r--r--docs/contributing.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/contributing.md b/docs/contributing.md
index 7ed7cd06a5..bcedcaf974 100644
--- 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.