STYLE: Use braces for single line conditional loop body statements#3868
Conversation
Use braces also for single line conditional loop body statements following the ITK SW style guidelines.
N-Dekker
left a comment
There was a problem hiding this comment.
OK of course, thanks Jon, but doesn't this occur on many more places? For example
ITK/Modules/Core/Common/include/itkMath.h
Lines 412 to 415 in 56ad54c
You may find them all by a regular expression like if \(.+\)\r\n [ ]+[^ {] According to Notepad++ (on Windows), it has 265 hits in 109 files (using Filter = itk*.h;itk*.hxx;itk*.cxx)
|
@N-Dekker Of course, it does. It was not meant to be a comprehensive PR at all; I just came across this while looking at other things, and I did not use a regex. However, I would very much appreciate a sweeping PR, but please contribute a script to the Edit: Include |
|
Thanks for explaining why you only addressed this particular case, Jon. I don't have time to address the other 200+ cases right now. I want to focus now on getting the initialization done (including PR #3851). If it is a priority to you, the regular expression that I posted ( |
The regex is of great help to find them, and I'd very much like to have them changed, ideally with the regex and a script, but am also focusing on other changes now. |
|
Alternatively, we can set the state of this PR to draft or open an issue. What do you think @N-Dekker ? |
Looks like a good plan. By the way, I would just do the find-replace in the editor (Notepad++) or IDE (Visual Studio), so then I would not really have a script file. The main thing is to get the regular expression right. And it seems sufficient to me to just mention the regular expression in the commit message and/or the pull request. But of course, if you could write a script file (bash/bat/shell/python or even C++), feel free to do so. Note that the style improvement to add braces to single statements can be done with a find-replace in an editor, while for the in-class |
|
Superseded by #3875. |
Use braces also for single line conditional loop body statements following the ITK SW style guidelines.
PR Checklist