seanm
(Sean McBride)
October 25, 2019, 7:53pm
1
Hi all,
I’m trying to submit a simple one line patch, but committing gives me:
[attr]our-c-style whitespace=tab-in-indent,no-lf-at-eof hooks.style=KWStyle,clangformat
not allowed: ./.gitattributes:31
[attr]our-c-style whitespace=tab-in-indent,no-lf-at-eof hooks.style=KWStyle,clangformat
not allowed: ./.gitattributes:31
Modules/Core/ImageFunction/test/itkSumOfSquaresImageFunctionGTest.cxx:47: error: Unnecessary semicolon
Modules/Core/ImageFunction/test/itkSumOfSquaresImageFunctionGTest.cxx:130: error: Unnecessary semicolon
pre-commit hook failure
1 Like
jhlegarreta
(Jon Haitz Legarreta Gorroño)
October 25, 2019, 8:08pm
2
Hi @seanm ,
although I have not contributed since it was put in place, a new pre-commit hook that checks the style was put in place recently .
May be you will need to configure the tool so that it automatically enforces the adopted style.
seanm
(Sean McBride)
October 25, 2019, 8:08pm
3
Strange, it seems to have chopped off half my message. The second half was:
KWStyle check failed.
Line numbers in the errors shown refer to the file:
Modules/Core/ImageFunction/test/itkSumOfSquaresImageFunctionGTest.cxx.kws
If I remove the “unnecessary” semi-colon at line 47 compilation fails.
How do I bypass this?
Thanks,
Sean
jhlegarreta
(Jon Haitz Legarreta Gorroño)
October 25, 2019, 8:18pm
4
May be the style format document needs to be revisited/does not handle properly this use case?
blowekamp
(Bradley Lowekamp)
October 25, 2019, 8:21pm
5
seanm:
How do I bypass this?
You should modify this file:
seanm
(Sean McBride)
October 25, 2019, 8:27pm
6
Note that the one line I’m trying to change is not the lines it’s complaining about. It complains about 2 different lines that I’ve not touched.
Bradley, what format is that file and how exactly should it be edited in my case?
This is an error can that occur with an older version of KWStyle
that did not support C++11.
To confirm the KWStyle
executable used:
cd ~/src/ITK
git config hooks.KWStyle.path
You may find that it is pointing to an older executable.
Next time ITK is built, it will build KWStyle
and configure Git to use the that version, which is new enough.
Alternatively, disable the KWStyle hook temporarily with:
git config hook.KWStyle false
or skip the pre-commit hooks with:
git commit -n
seanm
(Sean McBride)
October 25, 2019, 8:42pm
8
Thanks Matt. Indeed I had some random build of KWStyle. git commit -n did the trick.
1 Like
seanm
(Sean McBride)
October 25, 2019, 10:31pm
9
Matt, I just did a fresh vanilla build of ITK, and commits still fail. Where is the automagical build of KWStyle supposed to be? I doesn’t seem to get created for me.
dzenanz
(Dženan Zukić)
October 26, 2019, 1:34pm
10
This should take care of building KWStyle:
and it is included from here:
#-----------------------------------------------------------------------------
# ITK build classes that are in the review process
# ITK_USE_REVIEW is deprecated, only kept for backward compatibility
if (ITK_USE_REVIEW AND NOT Module_ITKReview)
message(WARNING "ITK_USE_REVIEW is deprecated, please use Module_ITKReview to turn Review module ON/OFF")
set(Module_ITKReview ON CACHE BOOL "Module containing code from the Review directory of ITKv4." FORCE)
endif()
#-----------------------------------------------------------------------------
# ITK uses KWStyle for checking the coding style
include(${ITK_SOURCE_DIR}/Utilities/KWStyle/KWStyle.cmake)
#-----------------------------------------------------------------------------
# Build the Examples that are illustrated in the Software Guide.
option(BUILD_EXAMPLES "Build the examples from the ITK Software Guide." OFF)
#-----------------------------------------------------------------------------
# Enable GPU support. Requires OpenCL to be installed
option(ITK_USE_GPU "GPU acceleration via OpenCL" OFF)
mark_as_advanced(ITK_USE_GPU)
1 Like