aboutsummaryrefslogtreecommitdiff
path: root/docs/contributing.md
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/contributing.md
parentcfa9f6ba6da7e6d3435610d6d3b4b7971d3dd547 (diff)
downloadqmk_firmware-7458ac94897afa7f67d98bc40aa1e090c11c235d.tar.gz
qmk_firmware-7458ac94897afa7f67d98bc40aa1e090c11c235d.zip
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/contributing.md')
-rw-r--r--docs/contributing.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/contributing.md b/docs/contributing.md
index 7ed7cd06a..bcedcaf97 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -57,14 +57,14 @@ Never made an open source contribution before? Wondering how contributions work
57Most 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: 57Most 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:
58 58
59* We indent using two spaces (soft tabs) 59* We indent using two spaces (soft tabs)
60* We use One True Brace Style 60* We use a modified One True Brace Style
61 * Opening Brace: At the end of the same line as the statement that opens the block 61 * Opening Brace: At the end of the same line as the statement that opens the block
62 * Closing Brace: Lined up with the first character of the statement that opens the block 62 * Closing Brace: Lined up with the first character of the statement that opens the block
63 * Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line. 63 * Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line.
64 * Optional Braces: Always include optional braces. 64 * Optional Braces: Always include optional braces.
65 * Good: if (condition) { return false; } 65 * Good: if (condition) { return false; }
66 * Bad: if (condition) return false; 66 * Bad: if (condition) return false;
67* We use C style comments: `/* */` 67* We encourage use of C style comments: `/* */`
68 * Think of them as a story describing the feature 68 * Think of them as a story describing the feature
69 * Use them liberally to explain why particular decisions were made. 69 * Use them liberally to explain why particular decisions were made.
70 * Do not write obvious comments 70 * 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
72* 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. 72* 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.
73* 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`) 73* 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`)
74 74
75Here is an example for easy reference:
76
77```c
78/* Enums for foo */
79enum foo_state {
80 FOO_BAR,
81 FOO_BAZ,
82};
83
84/* Returns a value */
85int foo(void) {
86 if (some_condition) {
87 return FOO_BAR;
88 } else {
89 return -1;
90 }
91}
92```
93
75# General Guidelines 94# General Guidelines
76 95
77We 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. 96We 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.