Skip to content

Add formatter (clang-format) configuration #434

@septatrix

Description

@septatrix

The project currently does not use consistent formatting throughout the codebase. This makes it sometimes confusing to know which pattern to follow. However, more importantly, in the context of the xv6 course/labs, this makes it harder to track changes and impossible to use an auto-formatter.

In many places there is trailing whitespace like spaces. Even without an explicit formatter, most IDEs will trim those. When checking ones changes before submitting this makes it hard to see which changes one implemented manually and in which places there were only whitespace changes. (I know that whitespace changes can often be suppressed but not everyone might know that, and it might not always be desired.) And using an auto-formatter is impossible because it will reformat most of the codebase making it impossible to track changes.

I propose to add a .clang-format file to the repository root and reformat the codebase accordingly. Additionally, CI should be set up such that a PR should only be accepted if it follows the code style to ensure future conformance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions