Open jori-nordic opened 1 year ago
We used to have a discussion that was closed due to inactivity too: https://github.com/zephyrproject-rtos/zephyr/discussions/41120
There are a lot of code styles that we haven't agreed on, and thus probably shouldn't be enforced.
I think we can state somewhere that they aren't "rules" per se, but rather recommendations and mention that it's a rather informal and living document. Then you can make a PR, doesn't have to be an exhaustive list, just the ones you feel the most strongly about. Does that sound good?
edit: the purpose of this task really is that once we have that document, a style comment on a PR should have a corresponding entry in that document, or shouldn't be made. That way we cut down on the review noise and can focus on the actual behavior/functionality.
the purpose of this task really is that once we have that document, a style comment on a PR should have a corresponding entry in that document, or shouldn't be made.
That assumes that we can agree on such rules :D And we would also need to ensure that they do not conflict with any of the non-BT Coding Guidelines (https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html)
That way we cut down on the review noise and can focus on the actual behavior/functionality.
IMO the only way we can really achieve this, is if we can have a tool in CI run these tests, but that would require general support from Zephyr, as such a tool should apply for the entire Zephyr project.
Personally I agree with your statements, but having tried to walk down the path of BT specific guidelines, I don't have high hopes for a solution. I won't take the lead on this, but I'll support anyone that will :)
Alright, I'll assign it to myself then. I'll try to start with a small subset we can all agree on.
another instance of this https://github.com/zephyrproject-rtos/zephyr/pull/55952#issuecomment-1476146602
Something to consider too: opaque data types https://github.com/zephyrproject-rtos/zephyr/pull/72090#discussion_r1598901459
why, when and where to use const
https://github.com/zephyrproject-rtos/zephyr/pull/72090#discussion_r1599731797
What about #ifdef
comments: https://github.com/zephyrproject-rtos/zephyr/pull/72090#discussion_r1603242269
implicit casts to bool: https://github.com/zephyrproject-rtos/zephyr/pull/72090#discussion_r1616716521
implicit casts to bool: #72090 (comment)
This is required by MISRA 14.4: https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#id29
We don't yet require PRs to comply with the MISRA rules IIRC
retval
, ret
or err
? hmmm https://github.com/zephyrproject-rtos/zephyr/pull/72674#discussion_r1601351663
Should values in enum use the enum name as prefix? https://github.com/zephyrproject-rtos/zephyr/pull/73527#discussion_r1621925972
Reviewers for Bluetooth patches seem to have a clear idea of the coding standard that the Bluetooth subsystem is supposed to follow, but this isn't documented anywhere.
Create a "coding style" page with all the do's and don'ts here https://docs.zephyrproject.org/latest/connectivity/bluetooth/index.html
It can include stuff like doxygen commenting style, newline before return, scope of vars, etc..