CMake文件静态代码检查器
项目描述
CMakeLint
cmakelint解析CMake文件并报告样式问题。
cmakelint需要Python。
安装
要从PyPI安装cmakelint,请运行
.. code-block:: bash
$ pip install cmakelint
用法
Syntax: cmakelint [--config=file] [--filter=-x,+y] <file> [file] ...
filter=-x,+y,...
Specify a comma separated list of filters to apply
config=file
Use the given file for configuration. By default the file
$PWD/.cmakelintrc, ~/.config/cmakelintrc, $XDG_CONFIG_DIR/cmakelintrc or
~/.cmakelintrc is used if it exists. Use the value "None" to use no
configuration file (./None for a file called literally None) Only the
option "filter=" is currently supported in this file.
运行不带过滤器的--filter=
选项以查看可用选项。目前这些是
convention/filename
linelength
package/consistency
readability/logic
readability/mixedcase
readability/wonkycase
syntax
whitespace/eol
whitespace/extra
whitespace/indent
whitespace/mismatch
whitespace/newline
whitespace/tabs
一个示例 .cmakelintrc 文件可能如下所示
filter=-whitespace/indent
将此文件放在您的家目录中,运行以下命令会产生相同的效果
cmakelint.py CMakeLists.txt
cmakelint.py --filter=-whitespace/indent CMakeLists.txt
过滤器可以可选地从CMake文件内部直接启用/禁用,覆盖文件或CLI参数的配置
# lint_cmake: <+ or -><filter name>
# e.g.:
# lint_cmake: -readability/wonkycase
# add multiple filters as list:
# lint_cmake: <+/-><filter1>, <+/-><filter2>
cmakelint还可以与pre-commit一起运行。将以下配置块添加到您的 .pre-commit-config.yaml
- repo: https://github.com/cmake-lint/cmake-lint
hooks:
- id: cmakelint
输出状态码
程序应使用以下状态码退出
- 如果一切正常,则为0
- 如果发出错误消息,则为1
- 在用法错误时为32
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分发
cmakelint-1.4.3.tar.gz (69.6 kB 查看哈希值)
构建分发
cmakelint-1.4.3-py3-none-any.whl (13.1 kB 查看哈希值)
关闭
cmakelint-1.4.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 98a1e485318b41eeaf4dee3469ca3039d4745985353ecea208d6dd2c1204c71d |
|
MD5 | abb9439a1b8fd5a300d9151fb16049ff |
|
BLAKE2b-256 | 9f469b6c39837be138179347611ec8cb79bf00ff3b54966ee8b63e031a05cf76 |
关闭
cmakelint-1.4.3-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d812accc44d4b34bdf115c5be230c7d80566f333c9a4a60e81fd5a54bf953f9e |
|
MD5 | 0ce7b2588a70e085345bdbe35025d1cf |
|
BLAKE2b-256 | 532460911dd02598ef4e1b38ff545d1eca33c66158cdca03b20b85575acc5588 |