cmake_check
cmake_check copied to clipboard
Provide example config.json
No idea how config.json should look like. Also, it might be best to allow this tool to work without a config, with some sane defaults!
An example is provided, also documentation for the file is provided: https://github.com/DaelDe/cmake_check/blob/master/doc/Configuration.adoc https://github.com/DaelDe/cmake_check/blob/master/res/config.json
This is the initial version of the documentation, feedback is appreciated.
I also thought about some defaults but did not come up with a set of options useful for everyone because there is no standard yet. A very basic setup is possible but it would not fit everyone of course.
Any suggestions?
I'm not yet used to the configuration format enough to write it myself, but basically, I think the default config should be a minimal blacklist that bans most common "bad commands" and "bad style". Take a look at what a few articles specify shouldn't be used, and write something based on that. It might be more than just command occurrences!
Btw, I've looked at the current config, and I think it's very low level (too low level!) If I need to specify a list of banned commands I might as well write a bash script myself. I recommend looking at some other linters, for example this is a Lua one that I think is fairly decent: https://luacheck.readthedocs.io/en/stable/config.html . Having a high level config allows you to produce more informative error messages (e.g. Error: Don't use $this_cmake_command: text or http://url_explaining_the_issue and offering a suggestion
OK, I opened #36 to have a default config, this is reasonable. The articles you mentioned are partly outdated. And yes, a lot of Modern CMake is just command occurences and from my experience these are the most violated rules (e.g. in my company). However, cmake_check is designed to do complex checks. Please propose specific checks you need.
You can write a bash script but banning commands but it is more than just a grep (for example a command name in a multi-line bracket argument).
The config is designed to write high-level rules that consist of low-level checks. Your proposal for error formatting is good, but since there is no standard style-guide and everyone treats CMake a little different (still 'modern') it is hard to find general rules. Proposals welcome :wink: