-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Closed
Copy link
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: Documentation
Description
Is your enhancement proposal related to a problem? Please describe.
At review-time, a disproportionate amount of time is spent by contributors and reviewers discussing include guards. There are a number of problems with this:
- This is not documented in the Contribution Guidelines.
The guidelines defer to the Linux kernel coding style, which does not define or enforce the style. Contributors can't know this expectation in advance of doing their work. This is a problem because it is demotivating for Contributors, and a problem for the project because it slows development down. - The codebase is inconsistent.
This in itself would not be a problem if (1) was in effect, but there's also no way for a Contributor to look at prior-art and determine what they've done is wrong.
Describe the solution you'd like
- Defer to the kernel coding style.
Perhaps the easiest solution. Unless there's a technical reason that the Contributor's choice of include guard is a problem, leave it alone. - If there's a mandated requirement,
- Define and Document it.
Allow Contributors to know what they're expected to do before they invest their own time and effort in the codebase. They may decide, based on this, whether they want to contribute at all. - Provide hooks for checking it:
- A client side pre-commit (or pre-push) hook could determine whether a changed file is a header, and if the include guard matches the defined style.
- Extend the Compliance Checks to also check this.
Contributors may not be willing or able to run the client-side hooks, so check this.
- Provide scripts for fixing it:
- This is akin to the code-formatting hints already provided by CI. Hint at a solution, and provide a script to do the work.
- Define and implement a plan for the existing codebase.
Are existing files going to remain incosistent, or will they be fixed in a treewide tidy up, or as-and-when they are touched?
- Define and Document it.
Describe alternatives you've considered
Continue the status-quo, (existing codebase remains inconsistent, add-hoc review-time requests to change files occur).
Additional context
A good example of the self-inconsistent codebase can be seen in a single directory:
$ grep -hr -m1 '#ifndef' include/zephyr/dt-bindings/pinctrl/ | sort
which presents ~8 different conventions.
kartben
Metadata
Metadata
Assignees
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: Documentation
Type
Projects
Status
Done