Page MenuHomeHEPForge

Create and apply clang-format style
AcceptedPublic

Authored by tlatham on Nov 6 2023, 5:47 PM.

Details

Summary
  • Define clang-format style and enable formatting check in CI
  • Fix formatting of Markdown files
  • Remove old note about gcc5
  • Apply clang-format to source files

Closes T111

Test Plan

Purely formatting changes

Diff Detail

Repository
rLAURA laura
Branch
v3-patches
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 277
Build 277: arc lint + arc unit

Event Timeline

tlatham created this revision.
tlatham changed the visibility from "All Users" to "Public (No Login Required)".Nov 6 2023, 5:48 PM
tlatham changed the edit policy from "All Users" to "Laura (Project)".
tlatham added a project: Laura.

Since this is purely formatting changes, I think the main thing to review is that the formatting style looks reasonable and that the CI check looks ok. Up to you if you want to look through all the files!!

In parallel I need to check what happens if I apply the same formatting in the timedep branch and then try and merge the branches! If that doesn’t go so well we might have to postpone this change untill after merging timedep into master.

It looks like it is going to be a nightmare to merge timedep-branch into master if we apply this formatting first (even after applying the same formatting there first).
So what I'd propose is to merge the last actual code changes into master - will create the differential for that shortly - then create a new v3-patches branch, to which this formatting can then be applied, and release v3r6 from that branch. This Differential can be updated to accomplish that part.
The formatting can then be applied to master after merging in timedep-branch - will require a separate Differential at a later date.
Does that sound reasonable?

If in the meantime you want to make comments on the clang-format config and CI check, please go ahead. I can still take them into account as part of the above.

Clang formatting and CI check looks OK, so proceed with organising the appropriate branches.

  • Apply formatting in v3-patches branch

Formatting and CI check look OK.

This revision is now accepted and ready to land.Nov 24 2023, 4:32 PM
  • Updates to clang-format style for clang 16
  • Modify clang-format style to 4-space indentation
  • Fix missing newline in README
  • Scripts to fix indentation of Doxygen comment blocks
  • Further improve formatting style
  • Re-apply formatting to source files

Hi @jback, just a quick note to explain the new changes.

Since we are using the el9 LCG_104 platform for the format check, we're running clang 16, so I've updated the clang-format file to account for some new options that have become available since clang 12, which was the version I was originally working with (as per current EvtGen formatting),

I also decided to move to 4-space indentation instead of 8-space. This had the side effect that the Doxygen comment blocks looking ragged because clang-format doesn't touch the comment blocks, so I've written a python script to fix those and have added the running of that into the CI check.

I also made a few minor adjustments to improve the look of things a bit.

I hope this is final now! If you could take a quick look that would be much appreciated. I'd like to release v3r6 next week, if possible.

Many thanks!

The updated formatting looks good. This is ready to be merged for the new release.