Skip to content

Set up clang-format to maintain NUT source style #894

@jimklimov

Description

@jimklimov

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 .editorconfig file with settings equivalent to those requested by .clang-format such that common IDEs and other text editors can ensure the expected code style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIEntries 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 warnings

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions