InfiniTimeOrg / InfiniTimeOrg/InfiniTime

Improve clang-format to check newlines at end of file

Open
#2,127 4 comments 1 reaction 0 assignees View on GitHub

@FintasticMan is already working on this.

Since Oct 9, 2024.

  • #2139 by @FintasticMan — open
maintenance
Dominant language
C
Stars
3.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/InfiniTimeOrg/InfiniTime/pull/2107#discussion_r1765677368

@FintasticMan adds info on which clang-format version we could use https://github.com/InfiniTimeOrg/InfiniTime/pull/2107#discussion_r1769634701

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing open pull request #2139 and the repository's clang-format CI configuration. Check how the proposed clang-format version and trailing-newline option are applied, then verify that CI detects files missing a final newline without breaking supported formatting checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.