Repository navigation
Conversation
The list is empty; a reformatting commit adds its own hash here so that git blame skips it.
|
@seanm If we are going to diverge from the main nifti_c lib, I would propose making as many changes as necessary in one commit. I prefer to use clang format. I have had better luck with integration into my editor workflows. Additionally, we could keep in sync with ITK and reduce the overall maintenance headaches. |
|
I guess I thought at least making the indentation uniform would make it easier to work on the codebase, because currently it's a pain since touching different parts requires using different indentation, which my editor does not like. I'd also like to use clang-format eventually. I could give it another try, but even after using |
|
I think what @hjmjohnson is saying is we should merge all the "formatting cleanup" into a single bulk PR so we can ignore it for blame purposes (this would also be a place to setup a clang-format hook and github action to block merging any format fails. |
Ignoring things in blame doesn't require one big commit though, you can put as many SHAs as you want in a |
Closed PR comment#26 does what was asked for here, so this can probably be closed. @hjmjohnson's point above — clang-format rather than uncrustify, to stay in sync with ITK — is what it implements: ITK's @seanm, on your comment that "even after using This branch is 18 months stale and |
|
The three config files here are worth having. The uncrustify run that comes with them is what makes this hard to land, and I think the two should be separated. Recommendation: keep What the diff actually consists ofMeasured against the merge-base, counting only files that already existed:
Why the reformat half is expensive right nowIt rewrites 8 source files in Landing the reformat means every one of them has to be rebased through a whole-file reindentation, where git's rename and content detection is least reliable and a silent mis-resolution is most likely. The backlog is mostly confirmed bug fixes; paying that cost to land a change with no functional effect inverts the priority. It is also The config files stand on their own
If the reformat is still wanted afterward, the version that is cheap to review is one that runs uncrustify over the whole tree in a single commit, once the bug backlog has drained, with that commit's SHA added to |
0cec098 to
64974a1
Compare
|
Commit messages cleaned up in place (prefixes added, Recommendation, unchanged: land the three config commits, defer the reformat. Why no rebase
Measured on the branch as it stands: 2,486 added lines, of which 2,426 change only whitespace ( The split, and why the case is stronger nowThe four commits divide cleanly:
The first three conflict with nothing, are useful the moment they land, and make the fourth reproducible by anyone at any later date. The count of other open PRs touching the 8 files the reformat rewrites has gone from 15 to 21 since the earlier review: #21, #22, #24, #38, #39, #42, #43, #44, #47, #48, #49, #50, #52, #53, #55, #56, #58, #61, #67, #72, #74. Landing the reformat invalidates every one of them at once. Landing it after they merge costs nothing, because Two small things to fix whenever this is picked up
Commit messagesRewritten in place with Nothing was stripped: no commit here carried a tool trailer, a session URL, or a bare cross-reference. No build or test runNot run, and not meaningful for this branch in its current state: the reformat commit cannot be compiled against current |
gdevenyi
left a comment
There was a problem hiding this comment.
Review by Google Carbon
Verdict: Request Changes (WIP Draft)
Thank you for starting the repository formatting and EditorConfig effort. Before this PR moves out of draft, there are three blocking issues to resolve:
- Unscoped
[*]rule in.editorconfigbreaksMakefiles and non-C files: Applyingindent_style = space,indent_size = 3, andtrim_trailing_whitespace = trueunder a single[*]glob converts hard TABs to spaces in all 9 legacyMakefiles (breaking GNUmakewith*** missing separator), overrides 2-space indentation in.github/workflows/*.yml,.clang-tidy, andCMakeLists.txt, and strips intentional trailing double-spaces in.mdfiles. - Partial formatting &
nifti1.halignment/mirror breakage: Onlyniftilib/was formatted whilenifti2/,cifti/,znzlib/,fsliolib/, andnifticdf/were left untouched. In particular,niftilib/nifti1.hlost its aligned Doxygen + ANALYZE-7.5 side-by-side column layout and drifted fromnifti2/nifti1.h(which are currently byte-for-byte identical onmaster). Either excludenifti1.h/nifti2.hvia/* clang-format off */or format all libraries in a single coordinated pass after the ~30 open bugfix/hardening PRs land. - Template placeholders left in
.git-blame-ignore-revs: Still referencesimportant.pyand# TODO: add reformatting commitsinstead of the actual reformatting commit SHA(s).
Recommendation: Split out a small PR with a properly file-type-scoped .editorconfig and .clang-format tweaks first, and run the tree-wide clang-format + .git-blame-ignore-revs commit once the active bugfix PR queue settles.
| charset = utf-8 | ||
|
|
||
| # 3 space indentation | ||
| indent_style = space |
There was a problem hiding this comment.
[Google Carbon] Scoping indent_style = space and indent_size = 3 under [*] applies 3-space indentation to Makefiles (where GNU make requires hard TABs on recipe lines), YAML workflows, CMake files, and Markdown (trim_trailing_whitespace = true on line 20). Please scope C/C++ rules under [*.{c,h,cc,cpp,hpp}] and add explicit [Makefile] (indent_style = tab), [*.{yml,yaml,cmake}], [CMakeLists.txt], and [*.md] (trim_trailing_whitespace = false) sections.
| # $ git config blame.ignoreRevsFile .git-blame-ignore-revs | ||
| # | ||
|
|
||
| # TODO: add reformatting commits |
There was a problem hiding this comment.
[Google Carbon] This file still contains template boilerplate (important.py on line 7 and # TODO: add reformatting commits here). Once the final formatting commit is generated, record its 40-character SHA here (and drop the formatting commit itself into a dedicated commit separate from config changes so git blame --ignore-revs-file only skips pure whitespace changes).
| char regular; /*!< ++UNUSED++ */ /* char regular; */ | ||
| char dim_info; /*!< MRI slice ordering. */ /* char hkey_un0; */ | ||
| int sizeof_hdr; /*!< MUST be 348 */ /* int sizeof_hdr; */ | ||
| char data_type[10];/*!< ++UNUSED++ */ /* char data_type[10]; */ |
There was a problem hiding this comment.
[Google Carbon] Running clang-format over struct nifti_1_header collapses the space before /*!< on longer field declarations (data_type[10];/*!<, slice_duration;/*!<, aux_file[24];/*!<, intent_name[16];/*!<), breaking the aligned ANALYZE-7.5 reference table and breaking byte-for-byte parity with nifti2/nifti1.h. Wrapping the public header struct tables in /* clang-format off */ / /* clang-format on */ preserves readability and header parity.
No description provided.