cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
949 stars 104 forks source link

Support block-comment docstrings when using cmake-lint #267

Open vhirtham opened 3 years ago

vhirtham commented 3 years ago

Here is an example:

While this

# my docstring
# Parameters:
#     target: The target
function(my_add_executable target)
    add_executable(${target})
endfunction()

works just fine, using CMakes block comment feature like this

#[[
my docstring

Parameters:
    target: The target
]]
function(my_add_executable target)
    add_executable(${target})
endfunction()

will cause a linter error:

cmake/test.cmake:07,00: [C0112] Empty docstring on function or macro declaration

It would be a nice feature if the linter understands block comments as docstrings, especially if you have rather long docstrings. It's funny that the markdown code parser doesn't understand it either (as you can see above) since it isn't such a new CMakeFeature as you can see in this rather old (edited 2018) Stackoverflow answer