-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check for missing or duplicate newlines at the end of files #23166
Conversation
The check fails when not compliant: https://github.com/PX4/PX4-Autopilot/actions/runs/9191515223/job/25278084826?pr=23166 |
Hmm, e.g. SITL offboard, |
de5f9b1
to
4c6f0fe
Compare
4c6f0fe
to
2867100
Compare
I rebased the pr, this would have caught more newline issues since I opened the pr: e.g. https://github.com/PX4/PX4-Autopilot/pull/22904/files#r1681278804 |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
Solved Problem
When checking changes I realized people do commit missing or duplicate newlines every now and then. This seems like a non-issue and only leads to problems later on when some tooling doesn't work because the files are not POSIX compliant or whitespace checks fail in the middle of a merge. Manual passes like #22476 end up not enforcing the rules.
Solution
Changelog Entry
Alternatives
Ideally, this would also run through with
make format
but I don't add it because I feel it adds too much delay and hence prolongs the pre-commit hook. Better to have it ran in CI than not at all but maybe someone knows how to make the check more efficient such that the runtime is insignificant during commits.Test coverage
I tested locally that it triggers with:
Context
Inspiration: