-
Notifications
You must be signed in to change notification settings - Fork 224
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
Revisit "format-check" workflow - is it needed? #662
Comments
Some options going forward:
|
Whatever is chosen, hopefully it doesn't break the use case of applying format to format files. In other words I often lazy-edit, search replace, etc and don't bother w/ formatting. Then apply the format. Saves significant time, especially in early development for me. If I've got to go back and revert all the places where there were human in the loop decisions to not apply the formatting that breaks my workflow (or if main isn't kept as always format compliant). You can apply comment guards if you really want to avoid formatting something (messy, but supports both hand formatting and applying auto formatting to everything). I don't really care about individual merge requests, but hopefully main is kept in sync w/ some way to auto-format (whatever version folks want to use as long as it's available in a reasonable set of modern distributions). |
In other words, merges to main could just apply the formatting instead of as a check in every merge request. Either way works for me. |
If there's an update to 13, sounds like it'll align columns: https://stackoverflow.com/a/70782265 |
I'm running into issues in trying to match exactly what this workflow is expecting. One option would be to run clang-format as part of the workflow and generate an artifact of the output for those files that are flagged so that us devs can just download the reformatted and splat it in place. |
Thank you! I found that the workflow currently archives: cFS/.github/workflows/format-check.yml Lines 58 to 62 in 6cded58
To find the archived claang-format style differences artifact called "style_differences.txt":
|
What I'm looking for is the raw output of a reformatted file, if the differences reported are acceptable to me, I could just splat the whole file with the one from the workflow. But thanks for pointing out that the diff is available, trying to decode indention changes in the workflow output in the web UI is insufficient. :) |
Also something to consider: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code |
Fix #662, Removes error on format style differences
Checklist (Please check before submitting)
Describe the bug
The cFS CCB should revisit the cost/benefit of enforcing the "format-check" workflow on every push/pull. The original idea was that it would keep the white space formatting consistent, but in practice there are a lot of nuisances that result from this:
For examples of this, see the "CFE_TBL_CmdHandlerTbl" from an old version of CFE, before clang-format enforcement:
https://github.com/nasa/cFE/blob/8811c92094512975e14fd545df355705141560b2/fsw/cfe-core/src/tbl/cfe_tbl_task.c#L66-L85
Compared to the same table in the current version after clang-format messes with the column alignments, start and end braces, etc:
https://github.com/nasa/cFE/blob/98f78e8604c19415fd1e199eae94196a781539b8/modules/tbl/fsw/src/cfe_tbl_task.c#L68-L85
Other examples include the ES object table and any event registration table, where what was originally a logically aligned table became all disorganized.
Note that the file that failed here (fm_child_tests.c) did NOT change between these two runs. Something else changed, but its the same version of clang-format and the same .clang-format file from what I can tell.
Expected behavior
Tools should be a help, not a hinderance. Keeping up with clang-format nuisance errors might not be the best use of developer time?
Code snips
Provided inline
System observed on:
Ubuntu, Debian
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: