zephyr/doc/contribute
Carles Cufi 3c420a4828 checkpatch: Adapt the braces check to Zephyr
scripts/checkpatch.pl was written originally for the Linux kernel, and
its code reflects the kernel's coding style. In particular, it has
checks for unneeded braces around single-statement if/else/for/while
conditions. In Zephyr however, braces are always required, and so the
checks needed modifying to verify the opposite condition.

In order to enable the now-compatible checks, we also remove the
--ignore BRACES statement in .checkpatch.conf.

Limitations: the current code works well if there are not conditional
statements (e.g. #if, #ifdef or #endif) next to the if/else/for/while
conditions. This is rarely the case, but triggers with the Bluetooth
controller in code like this:

```
 #if defined(CONFIG_BT_PERIPHERAL)
        if (!lll->is_hdcd)
 #endif /* CONFIG_BT_PERIPHERAL */
        {
```

```
        } else
 #endif /* CONFIG_BT_CTLR_PRIVACY */
        {

```

```
 #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
        if (lll->cte_started) {
                radio_switch_complete(phy_s, 0, phy_s, 0);
        } else
 #endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
        {
```

```
 #ifdef DUAL_BANK
        while ((FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) ||
               (FLASH_STM32_REGS(dev)->SR2 & FLASH_SR_QW))
 #else
        while (FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW)
 #endif
        {
```

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-12-30 21:46:47 +01:00
..
coding_guidelines doc: coding guidelines: Refactor the guidelines rule table 2024-08-22 09:12:23 +02:00
documentation docs: contribute: documentation: generation: fix missing doc 2024-11-14 20:37:45 -06:00
media
bin_blobs.rst doc: blobs: Document startup notification 2024-10-21 15:58:27 +02:00
contributor_expectations.rst doc: contributor: change language around PR review escalation 2024-12-13 17:44:52 +01:00
external.rst doc: fix 404 error with Zephyr project charter 2024-07-31 10:07:11 +02:00
guidelines.rst checkpatch: Adapt the braces check to Zephyr 2024-12-30 21:46:47 +01:00
index.rst doc: sphinx-lint: fix bad usage of "default role" 2024-09-13 11:42:51 -05:00
proposals_and_rfcs.rst doc: fix links to wiki 2024-08-30 09:07:52 +02:00