Add three additional rules to the KDE coding guidelines for CMake source code

Ingo Klöcker kloecker at kde.org
Wed Jul 31 08:38:06 BST 2024


On Mittwoch, 31. Juli 2024 01:48:55 CEST Marius P wrote:
> Can we please modify the KDE coding guidelines for CMake source code
> https://community.kde.org/Policies/CMake_Coding_Style
> Such that we do not allow the following three issues:
> 
> 1. kconfig/src/core/CMakeLists.txt:36: Mismatching spaces inside ()
> after command [whitespace/mismatch]:
> "configure_file(config-kconfig.h.cmake
> ${CMAKE_CURRENT_BINARY_DIR}/config-kconfig.h )"
> 
> 2. kconfig/CMakeLists.txt:74: Extra spaces between 'include' and its
> () [whitespace/extra]:
> "include (ECMPoQmTools)"
> 
> 3. kcalc/CMakeLists.txt:96: Line ends in whitespace [whitespace/eol]:
> "   kcalc_const_menu.cpp "

If we want this (and I guess it makes sense the same way using clang-format 
and the other linters makes sense) then we should add a cmake linter CI job 
and maybe also a pre-commit hook. Maybe both as opt-in in case some projects 
want to keep using their own style (or maybe cmakelint is customizable?). This 
would likely reduce most of the CMake_Coding_Style policy (which, frankly, I 
wasn't even aware of and never looked for) to a simple "cmakelint must pass".

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20240731/812827c5/attachment.sig>


More information about the kde-devel mailing list