cmake tidy
Official beta release
format子命令analyze子命令項目的目的是提供一組工具,以減輕CMake編寫的構建系統代碼的開發過程。該工具的主要思想是但不限於:
CMake代碼格式 - 基於語言語法分析
現代CMake靜態分析 - 可能自動固定的基本代碼分析。
配置的靈活性很大 - 編碼樣式有很大差異。
易於使用 - 與其他最先進的工具模擬使用和參數,以減少用戶學習曲線。
cmake-tidy是python3編寫的命令行應用程序。
可用的子命令:
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子命令 usage: 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 file 用戶可以通過提供自定義.cmake-tidy.json文件為應用程序提供替代設置。有關可用參數和值的更多信息,請訪問此處。
analyze子命令引言正在進行中。
應用程序只能格式化有效的cmake文件(語法錯誤導致應用程序退出而無需修改格式文件的內容)。
支持舊版本的--version的deprecated關鍵字/屬性的支持可能有限。如果您需要支持它們,請提供拉動請求或將它們指定為.cmake-tidy.json配置文件中的自定義關鍵字。
線延續處理未實施。
該工具可通過命令通過python軟件包索引提供:
python3 -m pip install cmake-tidy為了確認安裝成功,您可以運行:
cmake-tidy -v自動測試是通過工作流進行的:
ubuntu-lastest, python-3.8
windows-lastest, python-3.8