-
Notifications
You must be signed in to change notification settings - Fork 43
Add Protection to, and clang-format Cycamore #644
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
base: main
Are you sure you want to change the base?
Conversation
…matted some pragmas checking for column limits, spelling, and grammar.
|
One day I'll remember the changelog before making a PR. One day. |
|
One final comment about the size of this PR: Because clang-format does so much I figured that instead of three +1500 / - 1496 line changes it might be better to do it all as one massive +3000 / -3000 line PR 😬 |
Build Status Report - 0cb2ab9 - 2025-07-06 12:34:26 -0600Build
|
|
I wonder if we can do this in cyclus/cyclus first and then get cyclus/cyclus#1674 implemented? It will need some |
gonuke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found one issue that may be problem when I started reviewing this - clang-format likes to reorder includes to be alphabetical, but we have an expectation (habit? need?) that we include cyclus.h before any other headers. Not sure if we can train clang-format to do something different, or if we have to make some other change to preserve the order.... or make the order less important.
| // These includes must come before others. | ||
| #include "cyclus.h" | ||
| #include "cycamore_version.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can force clang-format to not reorder these. I can't recall why these need to come first except that cyclus.h probably includes a whole bunch of stuff that we assume is included before the others are included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can just protect them with the comments like I do with the pragmas. That'd probably be the most straightforward way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found that same post a little while ago. The .clang-format for cyclus has SortIncludes: Never and I think that took care of things. If that's not already in the Cycamore one I'll for sure add it, though!
On it. |
gonuke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added SortIncludes in a suggestion comment, but I expect the whole code base will need to be reformatted from the original to preserve the original order... formatting in the branch will not sort them back
.clang-format
Outdated
| # Automatically detect whether a given fuction's arguments are one-per-line | ||
| ExperimentalAutoDetectBinPacking: true | ||
| # Use C++11 standard | ||
| Standard: Cpp11 No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Standard: Cpp11 | |
| Standard: Cpp11 | |
| # prefer to keep includes sorted as we like | |
| SortIncludes: Never |
|
Okay two things have now been done here:
|
|
This appears to need a rebase... |
|
Pinging @dean-krueger because I think this only needs a rebase to be considered for merging...? |
|
On it! |
Summary of Changes
This (massive, sorry) PR does three things: adds
//clang-format offand//clang-format onprotection to all#pragmablocks in cycamore/src, cleans up some of the#pragmablocks/checks spelling and grammar in comments, and then runsclang-formaton all the files in cycamore/src.Related CEPs and Issues
This PR is related to:
clang-formatcyclus#1674//clang-format off/onto protect all Cycamore Pragmas for clang-format #643Associated Developers
@ahnaf-tahmid-chowdhury
Design Notes
This PR, which I expect I will be told should be three PRs because it sort of does three separate (large) things, but which I'm going to do my darnedest to sneak by as one, was submitted as one PR because I used ChatGPT to help with a lot of the manual addition of
#pragmaprotection, and while it was doing that I asked it to run a spelling/grammar/general style check as well. Then, and most importantly, it would have been almost impossible to correctly check that I had done this correctly had I not been able to actually run clang-format on the code, at which point I figured I'd just submit everything since it's all tied together in this way.Testing and Validation
The code was built locally on my machine. No additional tests were added.
Checklist
Reviewers, please refer to the Cyclus Guide for Reviewers.