commontk / CTK

A set of common support code for medical imaging, surgical navigation, and related purposes.
https://commontk.org
Apache License 2.0
855 stars 490 forks source link

STYLE: Convert C++ source files from old-style "Whitesmiths" to "Allman" style #1193

Closed jcfr closed 7 months ago

jcfr commented 7 months ago

Adapted from similar pull request integrated in Slicer, see https://github.com/Slicer/Slicer/pull/7596


This commit reindents the C++ source files to adhere to the "Allman" style, moving away from the outdated and VTK-specific "Whitesmiths" style. The changes are applied using an approach similar to the one utilized in kitware/VTK@f830ff47b3 ("Reindent using the reindentation script," 2016-09-23).

These modifications are made in anticipation of future changes that will introduce the use of a standard configuration based on clang-format.

Once integrated, this commit will be added to the .git-blame-ignore-revs^1 file.


Steps Taken:

  1. The script Utilities/Maintenance/vtk_reindent_code.py is executed, leveraging the approach from kitware/VTK@b6fec283cc. The command used is as follows:
fd -e cxx -e h -e cpp -e cxx.in -e cpp.in -e h.in -e txx -x \
  python3.9 /path/to/VTK/Utilities/Maintenance/vtk_reindent_code.py {}
  1. Manual review and adjustments are performed to address the errors identified during the reindentation process (see below).

  2. Update the indentations associated with macros to ensure proper alignment of backslashes. To identify the affected files, the following one-liner was utilized:

for file in $(git diff HEAD --name-only); do
  git diff HEAD -- $file | ack "\+.+\s\\\\$" > /dev/null 2>&1 && echo $file;
done

Errors identified during the reindentation process:

Libs/Widgets/ctkTestApplication.h:64: mismatched '}'