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.

125 lines
8.6 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.
  4. ## General 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. ChibiOS, or imported files from other repositories etc.)
  10. - If there is enough 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. - 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.
  15. - QMK codebase "best practices" followed
  16. - This is not an exhaustive list, and will likely get amended as time goes by
  17. - `#pragma once` instead of `#ifndef` include guards in header files
  18. - No "old-school" GPIO/I2C/SPI functions used -- must use QMK abstractions unless justifiable (and laziness is not valid justification)
  19. - Timing abstractions should be followed too:
  20. - `wait_ms()` instead of `_delay_ms()` (remove `#include <util/delay.h>` too)
  21. - `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
  22. - If you think a new abstraction is useful, you're encouraged to:
  23. - prototype it in your own keyboard until it's feature-complete
  24. - discuss it with QMK Collaborators on Discord
  25. - refactor it as a separate core change
  26. - remove your specific copy in your board
  27. ## Core PRs
  28. - Must now target `develop` branch, which will subsequently be merged back to `master` on the breaking changes timeline
  29. - Other notes TBD
  30. - Core is a lot more subjective given the breadth of posted changes
  31. ## Keyboard PRs
  32. Closed PRs (for inspiration, previous sets of review comments will help you eliminate ping-pong of your own reviews):
  33. https://github.com/qmk/qmk_firmware/pulls?q=is%3Apr+is%3Aclosed+label%3Akeyboard
  34. - `info.json`
  35. - valid URL
  36. - valid maintainer
  37. - displays correctly in Configurator (press Ctrl+Shift+I to preview local file, turn on fast input to verify ordering)
  38. - `readme.md`
  39. - standard template should be present
  40. - flash command has `:flash` at end
  41. - 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.
  42. - `rules.mk`
  43. - removed `MIDI_ENABLE`, `FAUXCLICKY_ENABLE` and `HD44780_ENABLE`
  44. - modified `# Enable Bluetooth with the Adafruit EZ-Key HID` -> `# Enable Bluetooth`
  45. - No `(-/+size)` comments related to enabling features
  46. - Remove the list of alternate bootloaders if one has been specified
  47. - 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)
  48. - keyboard `config.h`
  49. - don't repeat `MANUFACTURER` in the `PRODUCT` value
  50. - no `#define DESCRIPTION`
  51. - no Magic Key Options, MIDI Options or HD44780 configuration
  52. - user preference configurable `#define`s need to be moved to keymap `config.h`
  53. - "`DEBOUNCE`" instead of "`DEBOUNCING_DELAY`"
  54. - bare minimum required code for a board to boot into QMK should be present
  55. - initialisation code for the matrix and critical devices
  56. - mirroring existing functionality of a commercial board (like custom keycodes and special animations etc.) should be handled through non-`default` keymaps
  57. - `keyboard.c`
  58. - empty `xxxx_xxxx_kb()` or other weak-defined default implemented functions removed
  59. - commented-out functions removed too
  60. - `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)
  61. - prefer `CUSTOM_MATRIX = lite` if custom matrix used, allows for standard debounce, see [custom matrix 'lite'](https://docs.qmk.fm/#/custom_matrix?id=lite)
  62. - `keyboard.h`
  63. - `#include "quantum.h"` appears at the top
  64. - `LAYOUT` macros should use standard definitions if applicable
  65. - Use the Community Layout macro names where they apply (preferred above `LAYOUT`/`LAYOUT_all`)
  66. - keymap `config.h`
  67. - no duplication of `rules.mk` or `config.h` from keyboard
  68. - `keymaps/default/keymap.c`
  69. - `QMKBEST`/`QMKURL` removed (sheesh)
  70. - 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...
  71. ```
  72. layer_state_t layer_state_set_user(layer_state_t state) {
  73. return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  74. }
  75. ```
  76. ...instead of manually handling `layer_on()`, `update_tri_layer()` inside the keymap's `process_record_user()`.
  77. - default (and via) keymaps should be "pristine"
  78. - bare minimum to be used as a "clean slate" for another user to develop their own user-specific keymap
  79. - standard layouts preferred in these keymaps, if possible
  80. - 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
  81. - submitters can also have a "manufacturer-matching" keymap that mirrors existing functionality of the commercial product, if porting an existing board
  82. Also, specific to ChibiOS:
  83. - **Strong** preference to using existing ChibiOS board definitions.
  84. - 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
  85. - Example: For an STM32L082KZ, given the similarity to an STM32L073RZ, you can use `BOARD = ST_NUCLEO64_L073RZ` in rules.mk
  86. - QMK is migrating to not having custom board definitions if at all possible, due to the ongoing maintenance burden when upgrading ChibiOS
  87. - If a board definition is unavoidable, `board.c` must have a standard `__early_init()` (as per normal ChibiOS board defs) and an empty `boardInit()`:
  88. - see Arm/ChibiOS [early initialization](https://docs.qmk.fm/#/platformdev_chibios_earlyinit?id=board-init)
  89. - `__early_init()` should be replaced by either `early_hardware_init_pre()` or `early_hardware_init_post()` as appropriate
  90. - `boardInit()` should be migrated to `board_init()`
  91. ## Keymap PRs
  92. - `#include QMK_KEYBOARD_H` preferred to including specific board files
  93. - Prefer layer `enum`s to `#define`s
  94. - Require custom keycode `enum`s to `#define`s, first entry must have ` = SAFE_RANGE`
  95. - Terminating backslash (`\`) in lines of LAYOUT macro parameters is superfluous
  96. - Some care with spacing (e.g., alignment on commas or first char of keycodes) makes for a much nicer-looking keymap
  97. ---
  98. ## Notes
  99. For when people use their own `master` branch, post this after merge:
  100. ```
  101. 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.
  102. There are instructions on how to keep your fork updated here:
  103. [**Best Practices: Your Fork's Master: Update Often, Commit Never**](https://docs.qmk.fm/#/newbs_git_using_your_master_branch)
  104. [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.
  105. Thanks for contributing!
  106. ```