zephyr/scripts
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
..
build UF2: Enable support for Raspberry Pi RP2350 2024-12-23 23:57:57 +01:00
checkpatch scripts: checkpatch: add NRF_GPIO_Type to typedefs file 2024-11-01 12:10:12 -05:00
ci CODEOWNERS: drop CODEOWNERS file as it's not used anymore 2024-12-03 04:01:27 +01:00
coccinelle
coredump scripts: coredump: Fix loading coredumps when thread info is enabled. 2024-12-09 22:06:23 +00:00
dts devicetree: Add DT_FOREACH_ANCESTOR macro 2024-12-18 10:17:09 +01:00
footprint ci: footprint: fix nrf5340dk/nrf5340/cpuapp board name 2024-10-25 14:08:18 +02:00
generate_usb_vif python: Format and sort imports 2024-11-25 10:07:13 +01:00
gitlint
kconfig kconfig: Add dt_compat_any_not_has_prop function 2024-12-16 13:09:14 +01:00
logging/dictionary scripts: logging: dictionary: fix parsing of DWARF v5 2024-12-20 12:36:46 +01:00
native_simulator
net
profiling
pylib twister: add dt_node_prop_enabled support 2024-12-20 18:30:43 +01:00
pylint/checkers
release
ruff scripts: Add helper scripts for ruff baseline excludes 2024-11-19 18:36:54 -05:00
schemas sysbuild: Add support for snippets 2024-12-27 07:18:13 +01:00
support
tests twister: handlers: Pass harness reason to instance 2024-12-17 11:37:40 +00:00
tracing
utils python: Format and sort imports 2024-11-25 10:07:13 +01:00
west_commands soc: intel_adsp: add support for .cold* sections 2024-12-29 05:50:25 +01:00
.gitignore
check_maintainers.py python: Format and sort imports 2024-11-25 10:07:13 +01:00
checkpatch.pl checkpatch: Adapt the braces check to Zephyr 2024-12-30 21:46:47 +01:00
checkstack.pl
coccicheck
dump_bugs_pickle.py
gen_gcov_files.py
get_maintainer.py
github_helpers.py
list_boards.py scripts: Undo Board.{dir -> directories[0]} renames 2024-10-26 17:14:06 +02:00
list_hardware.py scripts: list_hardware: Do not check qualifiers for run once config 2024-10-26 17:14:06 +02:00
list_shields.py
make_bugs_pickle.py
requirements-base.txt Revert "cmake: remove enforcement of DWARF v4" 2024-12-20 16:05:23 +01:00
requirements-build-test.txt
requirements-compliance.txt scripts: Update and lock ruff 2024-12-03 23:30:00 +00:00
requirements-extras.txt scripts: Remove zcbor requirement from requirements-extras.txt 2024-12-23 17:09:43 +01:00
requirements-run-test.txt
requirements.txt
series-push-hook.sh
set_assignees.py
snippets.py sysbuild: Add support for snippets 2024-12-27 07:18:13 +01:00
spelling.txt
tags.sh
twister scripts: twister: Python Version Guard 2024-11-04 17:24:24 -05:00
valgrind.supp
west-commands.yml scripts: west-commands: add an entry for the patch command 2024-12-24 11:15:38 +01:00
zephyr_module.py scripts: west_commands: Add packages command 2024-11-25 12:16:43 +01:00