format subcommandanalyze subcommandThe goal of project is to provide a set of tools that will ease the development process for build systems code written
in CMake. Main ideas of the tool are but not limited to:
CMake code formatting - based on language syntax analysis
modern CMake static analysis - basic code analysis with possible auto-fixing.
large flexibility of configuration - as coding styles differ quite a lot.
easy to use - mimic usage and parameters with other state-of-the-art tools to reduce learning curve for users.
cmake-tidy is a command-line application written in python3.
Available subcommands:
usage: cmake-tidy [-h] {format} ...
optional arguments:
-h, --help show this help message and exit
sub-commands:
{format} see "cmake-tidy <command> --help" to read more about a specific
sub-command.
format format file to align it to standardformat subcommandusage: cmake-tidy format [-h] [--dump-config] [-i] [--diff] [--verbose]
[input [input ...]]
positional arguments:
input CMake file to be formatted
optional arguments:
-h, --help show this help message and exit
--dump-config Dump to stdout current settings. Script tries to read
settings from `.cmake-tidy.json` or provides default
settings. Precedence of searching `.cmake-tidy.json` is
described on github
-i, --inplace Inplace edit specified <input_data> file
--diff Print to stdout unified diff between original file and
formatted version.
--verbose Print to stdout information about formatted fileUser can provide alternative settings to an application by providing custom .cmake-tidy.json file.
For more information about available parameters and values visit here.
analyze subcommandIntroduction is ongoing.
Application can format only valid cmake files (Syntax errors cause application to exit without modifying content of formatted file).
Support for deprecated keywords/properties for older version of cmake than specified in --version
command might be limited. If you need to support them please provide pull request or specify them as custom
keywords in .cmake-tidy.json config file.
Line continuation handling is not implemented.
The tool is available throught python package index using command:
python3 -m pip install cmake-tidyTo confirm installation was successful you can run:
cmake-tidy -vAutomated testing is done with workflows:
ubuntu-lastest, python-3.8
windows-lastest, python-3.8