-
-
Notifications
You must be signed in to change notification settings - Fork 427
Set up clang-format to maintain NUT source style #894
Copy link
Copy link
Open
Labels
CIEntries related to continuous integration infrastructure (here CI = tools + scripts + recipes)Entries related to continuous integration infrastructure (here CI = tools + scripts + recipes)refactor/fightwarnPR or issue proposal to improve code maintainability without functional changes, or to fix warningsPR or issue proposal to improve code maintainability without functional changes, or to fix warnings
Milestone
Metadata
Metadata
Assignees
Labels
CIEntries related to continuous integration infrastructure (here CI = tools + scripts + recipes)Entries related to continuous integration infrastructure (here CI = tools + scripts + recipes)refactor/fightwarnPR or issue proposal to improve code maintainability without functional changes, or to fix warningsPR or issue proposal to improve code maintainability without functional changes, or to fix warnings
Following up from #823, yet another effort in the back of my mind was to codify the NUT source style as documented, and provide tools to check and maintain it on both CI systems and developer workstations with
clang-format. Such work was already done by myself and others in zproject community, just porting is needed; the complicated part will be codifying the style itself into a configuration file. Examples:On a similar note, clang-tidy could be added for tracking code problems though that niche is currently occupied (non-exclusively) by the CI build matrix over many OSes and distros, and LGTM.com reports.
After that, the existing codebase can be reformatted: meaning a huge commit with lots of whitespace changes, but unless some tool bugs out - the result is congruent to original state as far as preprocessor and compiler are concerned... (that might be among the ways to check the impact actually).
Subsequently, any style offense in new commits and PRs is easily noticed and fixed, including a post-processing fix to do after a merge of contribution PRs.
UPDATE: It may also be convenient for developers (at a moderate low-frequency cost to maintainers) to provide also an
.editorconfigfile with settings equivalent to those requested by.clang-formatsuch that common IDEs and other text editors can ensure the expected code style.