From 2db4ad2133c229740c1a703eb83ae40396797797 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Wed, 11 Oct 2017 12:07:15 -0700 Subject: Write a contributing guide. (#1827) --- docs/_summary.md | 3 +- docs/adding_features_to_qmk.md | 16 ---- docs/documentation_templates.md | 42 ++++++++++ docs/getting_started_contributing.md | 147 +++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 17 deletions(-) delete mode 100644 docs/adding_features_to_qmk.md create mode 100644 docs/documentation_templates.md create mode 100644 docs/getting_started_contributing.md (limited to 'docs') diff --git a/docs/_summary.md b/docs/_summary.md index b085c18d7..4383bbb23 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -3,6 +3,7 @@ * [Install Build Tools](getting_started_build_tools.md) * Alternative: [Vagrant Guide](getting_started_vagrant_guide.md) * [Build/Compile instructions](getting_started_make_guide.md) + * [Contributing to QMK](getting_started_contributing.md) * [How to Use Github](getting_started_github.md) * [FAQ](faq.md) @@ -52,11 +53,11 @@ * [The `config.h` File](config_options.md) * [Customizing Functionality](custom_quantum_functions.md) * [Documentation Best Practices](documentation_best_practices.md) + * [Documentation Templates](documentation_templates.md) * [Unit Testing](unit_testing.md) * For Makers and Modders * [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md) - * [Adding features to QMK](adding_features_to_qmk.md) * [Hand Wiring Guide](hand_wiring.md) * [ISP flashing guide](isp_flashing_guide.md) * [Modding your keyboard](modding_your_keyboard.md) diff --git a/docs/adding_features_to_qmk.md b/docs/adding_features_to_qmk.md deleted file mode 100644 index e031ddbb7..000000000 --- a/docs/adding_features_to_qmk.md +++ /dev/null @@ -1,16 +0,0 @@ -# How To Add Features To QMK - -If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK! - -Before you put a lot of work into building your new feature you should make sure you are implementing it in the best way. You can get a basic understanding of QMK by reading [Understaning QMK](understanding_qmk.html), which will take you on a tour of the QMK program flow. From here you should talk to us to get a sense of the best way to implement your idea. There are two main ways to do this: - -* [Chat on Gitter](https://gitter.im/qmk/qmk_firmware) -* [Open an Issue](https://github.com/qmk/qmk_firmware/issues/new) - -Once you have implemented your new feature you will generally submit a [pull request](https://github.com/qmk/qmk_firmware/pulls). Here are some things to keep in mind when creating one: - -* **Disabled by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, please talk with us about it. -* **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back. -* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled on platforms it doesn't work on. -* **Explain your feature** - Document it in `docs/`, either as a new file or as part of an existing file. If you don't document it other people won't be able to benefit from your hard work. -* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues), we'd love to talk about how QMK can be improved. diff --git a/docs/documentation_templates.md b/docs/documentation_templates.md new file mode 100644 index 000000000..856a131a6 --- /dev/null +++ b/docs/documentation_templates.md @@ -0,0 +1,42 @@ +# Documentation Templates + +This page documents the templates you should use when submitting new Keymaps and Keyboards to QMK. + +## Keymap `readme.md` Template + +Most keymaps have an image depicting the layout. You can use [Keyboard Layout Editor](http://keyboard-layout-editor.com) to create an image. Upload it to [Imgur](http://imgur.com) or another hosting service, please do not include images in your Pull Request. + +Below the image you should write a short description to help people understand your keymap. + +``` +![Clueboard Layout Image](http://i.imgur.com/7Capi8W.png) + +# Default Clueboard Layout + +This is the default layout that comes flashed on every Clueboard. For the most +part it's a straightforward and easy to follow layout. The only unusual key is +the key in the upper left, which sends Escape normally, but Grave when any of +the Ctrl, Alt, or GUI modifiers are held down. +``` + +## Keyboard `readme.md` Template + +``` +# Planck + +![Planck](http://i.imgur.com/q2M3uEU.jpg) + +A compact 40% (12x4) ortholinear keyboard kit made and sold by OLKB and Massdrop. [More info on qmk.fm](http://qmk.fm/planck/) + +Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert) +Hardware Supported: Planck PCB rev1, rev2, rev3, rev4, Teensy 2.0 +Hardware Availability: [OLKB.com](https://olkb.com), [Massdrop](https://www.massdrop.com/buy/planck-mechanical-keyboard?mode=guest_open) + +Make example for this keyboard (after setting up your build environment): + + make planck-rev4-default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. +``` + +There needs to be two spaces at the end of the `Keyboard Maintainer` and `Hardware Supported` lines for it to render correctly with Markdown. diff --git a/docs/getting_started_contributing.md b/docs/getting_started_contributing.md new file mode 100644 index 000000000..b675f98b3 --- /dev/null +++ b/docs/getting_started_contributing.md @@ -0,0 +1,147 @@ +# How To Contribute + +πŸ‘πŸŽ‰ First off, thanks for taking the time to read this and contribute! πŸŽ‰πŸ‘ + +Third-party contributions help us grow and improve QMK. We want to make the pull request and contribution process useful and easy for both contributors and maintainers. To this end we've put together some guidelines for contributors to help your pull request be accepted without major changes. + +* [Project Overview](#project-overview) +* [Coding Conventions](#coding-conventions) +* [General Guidelines](#general-guidelines) +* [What does the Code of Conduct mean for me?](#what-does-the-code-of-conduct-mean-for-me) + +## I Don't Want To Read This Whole Thing I Just Have a Question! + +If you'd like to ask questions about QMK you can do so on the [OLKB Subreddit](https://reddit.com/r/olkb) or on [Gitter](https://gitter.im/qmk/qmk_firmware). + +Please keep these things in mind: + +* It may take several hours for someone to respond to your question. Please be patient! +* Everyone involved with QMK is donating their time and energy. We don't get paid to work on or answer questions about QMK. +* Try to ask your question so it's as easy to answer as possible. If you're not sure how to do that these are some good guides: + * https://opensource.com/life/16/10/how-ask-technical-questions + * http://www.catb.org/esr/faqs/smart-questions.html + +# Project Overview + +QMK is largely written in C, with specific features and parts written in C++. It targets embedded processors found in keyboards, particularly AVR ([LUFA](http://www.fourwalledcubicle.com/LUFA.php)) and ARM ([ChibiOS](http://www.chibios.com)). If you are already well versed in Arduino programming you'll find a lot of the concepts and limitations familiar. Prior experience with Arduino is not required to successfully contribute to QMK. + + + +# Where can I go for help? + +If you need help you can [open an issue](https://github.com/qmk/qmk_firmware/issues) or [chat on gitter](http://gitter.im/QMK/qmk_firmware). + +# How Do I Make a Contribution? + +Never made an open source contribution before? Wondering how contributions work in QMK? Here's a quick rundown! + +0. Sign up for a [GitHub](https://github.com) account. +1. Put together a keymap to contribute, [find an issue](https://github.com/qmk/qmk_firmware/issues) you are interested in addressing, or [a feature](https://github.com/qmk/qmk_firmware/issues?q=is%3Aopen+is%3Aissue+label%3Afeature) you would like to add. +2. Fork the repository associated with the issue to your GitHub account. This means that you will have a copy of the repository under `your-GitHub-username/qmk_firmware`. +3. Clone the repository to your local machine using `git clone https://github.com/github-username/repository-name.git`. +4. If you're working on a new feature consider opening an issue to talk with us about the work you're about to undertake. +5. Create a new branch for your fix using `git checkout -b branch-name-here`. +6. Make the appropriate changes for the issue you are trying to address or the feature that you want to add. +7. Use `git add insert-paths-of-changed-files-here` to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index. +8. Use `git commit -m "Insert a short message of the changes made here"` to store the contents of the index with a descriptive message. +9. Push the changes to your repository on GitHub using `git push origin branch-name-here`. +10. Submit a pull request to [QMK Firmware](https://github.com/qmk/qmk_firmware/pull/new/master). +11. Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352". +12. In the description of the pull request explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it! +13. Wait for the pull request to be reviewed by a maintainer. +14. Make changes to the pull request if the reviewing maintainer recommends them. +15. Celebrate your success after your pull request is merged! + +# Coding conventions + +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 + * 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: /* */ + * Think of them as a story describing the feature + * Use them liberally to explain why particular decisions were made. + * Do not write obvious comments + * If you not sure if a comment is obvious, go ahead and include it. +* 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. + +# 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. + +* Separate PR's into logical units. For example, do not submit one PR covering two separate features, instead submit a separate PR for each feature. +* Check for unnecessary whitespace with `git diff --check` before committing. +* Make sure your code change actually compiles. + * Keymaps: Make sure that `make keyboard-revision-your_new_keymap` does not return an error + * Keyboards: Make sure that `make keyboard-all` does not return any errors + * Core: Make sure that `make allkb` does not return any errors. +* Make sure commit messages are understandable on their own. You should put a short description (no more than 70 characters) on the first line, the second line should be empty, and on the 3rd and later lines you should describe your commit in detail, if required. Example: + +``` +Adjust the fronzlebop for the kerpleplork + +The kerpleplork was intermittently failing with error code 23. The root cause was the fronzlebop setting, which causes the kerpleplork to activate every N iterations. + +Limited experimentation on the devices I have available shows that 7 is high enough to avoid confusing the kerpleplork, but I'd like to get some feedback from people with ARM devices to be sure. +``` + +## Documentation + +Documentation is one of the easiest ways to get started contributing to QMK. Finding places where the documentation is wrong or incomplete and fixing those is easy! We also very badly need someone to edit our documentation, so if you have editing skills but aren't sure where or how to jump in please [reach out for help](#where-can-i-go-for-help)! + +You'll find all our documentation in the `qmk_firmware/docs` directory, or if you'd rather use a web based workflow you can click "Suggest An Edit" at the top of each page on http://docs.qmk.fm/. + +## Keymaps + +Most first-time QMK contributors start with their personal keymaps. We try to keep keymap standards pretty casual (keymaps, after all, reflect the personality of their creators) but we do ask that you follow these guidelines to make it easier for others to discover and learn from your keymap. + +* Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#). +* All Keymap PR's are squashed, so if you care about how your commits are squashed you should do it yourself +* Do not lump features in with keymap PR's. Submit the feature first and then a second PR for the keymap. + +## Keyboards + +Keyboards are the raison d'Γͺtre for QMK. Some keyboards are community maintained, while others are maintained by the people responsible for making a particular keyboard. The `readme.md` should tell you who maintains a particular keyboard. If you have questions relating to a particular keyboard you can [Open An Issue](https://github.com/qmk/qmk_firmware/issues) and tag the maintainer in your question. + +We also ask that you follow these guidelines: + +* Write a `readme.md` using [the template](https://docs.qmk.fm/documentation_templates.html#). +* Keep the number of commits reasonable or we will squash your PR +* Do not lump core features in with new keyboards. Submit the feature first and then submit a separate PR for the keyboard. + +## Quantum/TMK Core + +Before you put a lot of work into building your new feature you should make sure you are implementing it in the best way. You can get a basic understanding of QMK by reading [Understaning QMK](understanding_qmk.html), which will take you on a tour of the QMK program flow. From here you should talk to us to get a sense of the best way to implement your idea. There are two main ways to do this: + +* [Chat on Gitter](https://gitter.im/qmk/qmk_firmware) +* [Open an Issue](https://github.com/qmk/qmk_firmware/issues/new) + +Feature and Bug Fix PR's affect all keyboards. We are also in the process of restructuring QMK. For this reason it is especially important for significant changes to be discussed before implementation has happened. If you open a PR without talking to us first please be prepared to do some significant rework if your choices do not mesh well with our planned direction. + +Here are some things to keep in mind when working on your feature or bug fix. + +* **Disabled by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, please talk with us about it. +* **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back. +* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled on platforms it doesn't work on. +* **Explain your feature** - Document it in `docs/`, either as a new file or as part of an existing file. If you don't document it other people won't be able to benefit from your hard work. + +We also ask that you follow these guidelines: + +* Keep the number of commits reasonable or we will squash your PR +* Do not lump keyboards or keymaps in with core changes. Submit your core changes first. +* Write [Unit Tests](http://docs.qmk.fm/unit_testing.html) for your feature +* Follow the style of the file you are editing. If the style is unclear or there are mixed styles you should conform to the [coding conventions](#coding-conventions) above. + +## Refactoring + +To maintain a clear vision of how things are laid out in QMK we try to plan out refactors in-depth and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues), we'd love to talk about how QMK can be improved. + +# What does the Code of Conduct mean for me? + +Our Code of Conduct means that you are responsible for treating everyone on the project with respect and courtesy regardless of their identity. If you are the victim of any inappropriate behavior or comments as described in our Code of Conduct, we are here for you and will do the best to ensure that the abuser is reprimanded appropriately, per our code. -- cgit v1.2.3-24-g4f1b