Skip to content

Improve clang-format to check newlines at end of file #2127

@NeroBurner

Description

@NeroBurner

Verification

  • I searched for similar issues (including closed issues) and found none was relevant.

Introduce the issue

I regularly criticize missing newline at end of file resulting in stop symbol of GitHub
stop symbol of GitHub at end of files

@mark9064 suggested to let clang-format do this check #2107 (comment)

@FintasticMan adds info on which clang-format version we could use #2107 (comment)

I've just checked, and the option to insert trailing newlines has been added in clang-format 16. Last time I updated it was 14, so it wasn't included in that. I'll do a upgrade to a newer version soon.

What version do you think is reasonable to update to? Unfortunately, I don't think that clang-format ignores unrecognised options, so it'll be a minimum version for anyone using it.

Preferred solution

clang-format checks the missing newline at end of file in CI

Version

main

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions