You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
12 KiB

  1. # PR checklists
  2. This is a non-exhaustive checklist of what the QMK Collaborators will be checking when reviewing submitted PRs.
  3. If there are any inconsistencies with these recommendations, you're best off [creating an issue](https://github.com/qmk/qmk_firmware/issues/new) against this document, or getting in touch with a QMK Collaborator on [Discord](https://discord.gg/Uq7gcHh).
  4. ## Requirements for all PRs
  5. - PR should be submitted using a non-`master` branch on the source repository
  6. - this does not mean you target a different branch for your PR, rather that you're not working out of your own master branch
  7. - if submitter _does_ use their own `master` branch, they'll be given a link to the ["how to git"](https://docs.qmk.fm/#/newbs_git_using_your_master_branch) page after merging -- (end of this document will contain the contents of the message)
  8. - newly-added directories and filenames must be lowercase
  9. - this rule may be relaxed if upstream sources originally had uppercase characters (e.g. LUFA, ChibiOS, or imported files from other repositories etc.)
  10. - if there is valid justification (i.e. consistency with existing core files etc.) this can be relaxed
  11. - a board designer naming their keyboard with uppercase letters is not enough justification
  12. - valid license headers on all `*.c` and `*.h` source files
  13. - GPL2/GPL3 recommended for consistency
  14. - an example GPL2+ license header may be copied and modified from the bottom of this document
  15. - other licenses are permitted, however they must be GPL-compatible and must allow for redistribution. Using a different license will almost certainly delay a PR getting merged.
  16. - missing license headers will prevent PR merge due to ambiguity with license compatibility
  17. - QMK Codebase "best practices" followed
  18. - this is not an exhaustive list, and will likely get amended as time goes by
  19. - `#pragma once` instead of `#ifndef` include guards in header files
  20. - no "old-school" or other low-level GPIO/I2C/SPI functions may be used -- must use QMK abstractions unless justifiable (and laziness is not valid justification)
  21. - timing abstractions should be followed too:
  22. - `wait_ms()` instead of `_delay_ms()` (remove `#include <util/delay.h>` too)
  23. - `timer_read()` and `timer_read32()` etc. -- see [timer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/timer.h) for the timing APIs
  24. - if you think a new abstraction is useful, you're encouraged to:
  25. - prototype it in your own keyboard until it's feature-complete
  26. - discuss it with QMK Collaborators on Discord
  27. - refactor it as a separate core change
  28. - remove your specific copy in your board
  29. - fix all merge conflicts before opening the PR (in case you need help or advice, reach out to QMK Collaborators on Discord)
  30. ## Keymap PRs
  31. - `#include QMK_KEYBOARD_H` preferred to including specific board files
  32. - prefer layer `enum`s to `#define`s
  33. - require custom keycode `enum`s to `#define`s, first entry must have ` = SAFE_RANGE`
  34. - terminating backslash (`\`) in lines of LAYOUT macro parameters is superfluous
  35. - some care with spacing (e.g., alignment on commas or first char of keycodes) makes for a much nicer-looking keymap
  36. ## Keyboard PRs
  37. Closed PRs (for inspiration, previous sets of review comments will help you eliminate ping-pong of your own reviews):
  38. https://github.com/qmk/qmk_firmware/pulls?q=is%3Apr+is%3Aclosed+label%3Akeyboard
  39. - `info.json`
  40. - valid URL
  41. - valid maintainer
  42. - displays correctly in Configurator (press Ctrl+Shift+I to preview local file, turn on fast input to verify ordering)
  43. - `readme.md`
  44. - standard template should be present -- [link to template](https://github.com/qmk/qmk_firmware/blob/master/data/templates/avr/readme.md)
  45. - flash command is present, and has `:flash` at end
  46. - valid hardware availability link (unless handwired) -- private groupbuys are okay, but one-off prototypes will be questioned. If open-source, a link to files should be provided.
  47. - clear instructions on how to reset the board into bootloader mode
  48. - a picture about the keyboard and preferably about the PCB, too
  49. - images are not to be placed in the `qmk_firmware` repository
  50. - images should be uploaded to an external image hosting service, such as [imgur](https://imgur.com/).
  51. - `rules.mk`
  52. - removed `MIDI_ENABLE`, `FAUXCLICKY_ENABLE` and `HD44780_ENABLE`
  53. - modified `# Enable Bluetooth with the Adafruit EZ-Key HID` -> `# Enable Bluetooth`
  54. - no `(-/+size)` comments related to enabling features
  55. - remove the list of alternate bootloaders if one has been specified
  56. - no re-definitions of the default MCU parameters if same value, when compared to the equivalent MCU in [mcu_selection.mk](https://github.com/qmk/qmk_firmware/blob/master/quantum/mcu_selection.mk)
  57. - keyboard `config.h`
  58. - don't repeat `MANUFACTURER` in the `PRODUCT` value
  59. - no `#define DESCRIPTION`
  60. - no Magic Key Options, MIDI Options or HD44780 configuration
  61. - user preference configurable `#define`s need to be moved to keymap `config.h`
  62. - "`DEBOUNCE`" instead of "`DEBOUNCING_DELAY`"
  63. - bare minimum required code for a board to boot into QMK should be present
  64. - initialisation code for the matrix and critical devices
  65. - mirroring existing functionality of a commercial board (like custom keycodes and special animations etc.) should be handled through non-`default` keymaps
  66. - Vial-related files or changes will not be accepted, as they are not used by QMK firmware (no Vial-specific core code has been submitted or merged)
  67. - `<keyboard>.c`
  68. - empty `xxxx_xxxx_kb()` or other weak-defined default implemented functions removed
  69. - commented-out functions removed too
  70. - `matrix_init_board()` etc. migrated to `keyboard_pre_init_kb()`, see: [keyboard_pre_init*](https://docs.qmk.fm/#/custom_quantum_functions?id=keyboard_pre_init_-function-documentation)
  71. - prefer `CUSTOM_MATRIX = lite` if custom matrix used, allows for standard debounce, see [custom matrix 'lite'](https://docs.qmk.fm/#/custom_matrix?id=lite)
  72. - prefer LED indicator [Configuration Options](https://docs.qmk.fm/#/feature_led_indicators?id=configuration-options) to custom `led_update_*()` implementations where possible
  73. - `<keyboard>.h`
  74. - `#include "quantum.h"` appears at the top
  75. - `LAYOUT` macros should use standard definitions if applicable
  76. - use the Community Layout macro names where they apply (preferred above `LAYOUT`/`LAYOUT_all`)
  77. - keymap `config.h`
  78. - no duplication of `rules.mk` or `config.h` from keyboard
  79. - `keymaps/default/keymap.c`
  80. - `QMKBEST`/`QMKURL` removed
  81. - if using `MO(_LOWER)` and `MO(_RAISE)` keycodes or equivalent, and the keymap has an adjust layer when holding both keys -- if the keymap has no "direct-to-adjust" keycode (such as `MO(_ADJUST)`) then you should prefer to write...
  82. ```
  83. layer_state_t layer_state_set_user(layer_state_t state) {
  84. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  85. }
  86. ```
  87. ...instead of manually handling `layer_on()`, `update_tri_layer()` inside the keymap's `process_record_user()`.
  88. - default (and via) keymaps should be "pristine"
  89. - bare minimum to be used as a "clean slate" for another user to develop their own user-specific keymap
  90. - standard layouts preferred in these keymaps, if possible
  91. - default keymap should not enable VIA -- the VIA integration documentation requires a keymap called `via`
  92. - submitters can have a personal (or bells-and-whistles) keymap showcasing capabilities in the same PR but it shouldn't be embedded in the 'default' keymap
  93. - submitters can also have a "manufacturer-matching" keymap that mirrors existing functionality of the commercial product, if porting an existing board
  94. - Do not include VIA json files in the PR. These do not belong in the QMK repository as they are not used by QMK firmware -- they belong in the [VIA Keyboard Repo](https://github.com/the-via/keyboards)
  95. Also, specific to ChibiOS:
  96. - **strong** preference to using existing ChibiOS board definitions.
  97. - a lot of the time, an equivalent Nucleo board can be used with a different flash size or slightly different model in the same family
  98. - example: For an STM32L082KZ, given the similarity to an STM32L073RZ, you can use `BOARD = ST_NUCLEO64_L073RZ` in rules.mk
  99. - QMK is migrating to not having custom board definitions if at all possible, due to the ongoing maintenance burden when upgrading ChibiOS
  100. - if a board definition is unavoidable, `board.c` must have a standard `__early_init()` (as per normal ChibiOS board defs) and an empty `boardInit()`:
  101. - see Arm/ChibiOS [early initialization](https://docs.qmk.fm/#/platformdev_chibios_earlyinit?id=board-init)
  102. - `__early_init()` should be replaced by either `early_hardware_init_pre()` or `early_hardware_init_post()` as appropriate
  103. - `boardInit()` should be migrated to `board_init()`
  104. ## Core PRs
  105. - must now target `develop` branch, which will subsequently be merged back to `master` on the breaking changes timeline
  106. - other requirements are at the discretion of QMK collaborators
  107. - core is a lot more subjective given the breadth of posted changes
  108. ---
  109. ## Notes
  110. For when people use their own `master` branch, post this after merge:
  111. ```
  112. For future reference, we recommend against committing to your `master` branch as you've done here, because pull requests from modified `master` branches can make it more difficult to keep your QMK fork updated. It is highly recommended for QMK development – regardless of what is being done or where – to keep your master updated, but **NEVER** commit to it. Instead, do all your changes in a branch (branches are basically free in Git) and issue PRs from your branches when you're developing.
  113. There are instructions on how to keep your fork updated here:
  114. [**Best Practices: Your Fork's Master: Update Often, Commit Never**](https://docs.qmk.fm/#/newbs_git_using_your_master_branch)
  115. [Fixing Your Branch](https://docs.qmk.fm/#/newbs_git_resynchronize_a_branch) will walk you through fixing up your `master` branch moving forward. If you need any help with this just ask.
  116. Thanks for contributing!
  117. ```
  118. ## Review Process
  119. In general, we want to see two (or more) approvals that are meaningful (e.g. that have inspected code) before a PR will be considered for merge. These reviews are not limited to collaborators -- any community member willing to put in the time is welcomed (and encouraged). The only difference is that your checkmark won't be green, and that's fine!
  120. Additionally, PR reviews are something that is done in our free time. We are not paid nor compensated for the time we spend reviewing, as it is a labor of love. As such, this means that it can take time for us to get to your Pull Request. Things like family, or life can get in the way of us getting to PRs, and burnout is a serious concern. The QMK firmware repository averages 200 PRs opened and 200 PRs merged every month, so please have patience.
  121. ## Example GPLv2 Header
  122. ```
  123. /* Copyright 2021 Your Name (@yourgithub)
  124. *
  125. * This program is free software: you can redistribute it and/or modify
  126. * it under the terms of the GNU General Public License as published by
  127. * the Free Software Foundation, either version 2 of the License, or
  128. * (at your option) any later version.
  129. *
  130. * This program is distributed in the hope that it will be useful,
  131. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  132. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  133. * GNU General Public License for more details.
  134. *
  135. * You should have received a copy of the GNU General Public License
  136. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  137. */
  138. ```
  139. Or, optionally, using [SPDX identifier](https://spdx.org/licenses/) instead:
  140. ```
  141. // Copyright 2021 Your Name (@yourgithub)
  142. // SPDX-License-Identifier: GPL-2.0-or-later
  143. ```