# CMakeLint
[![Build Status](https://travis-ci.org/cmake-lint/cmake-lint.svg?branch=develop)](https://travis-ci.org/cmake-lint/cmake-lint)
![PyPI](https://img.shields.io/pypi/v/cmakelint.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dd/cmakelint.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/cmakelint.svg)
cmakelint parses CMake files and reports style issues.
cmakelint requires Python.
## Installation
To install cmakelint from PyPI, run:
.. code-block:: bash
$ pip install cmakelint
## Usage
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.
Run the `--filter=` option with no filter to see available options. Currently
these are:
convention/filename
linelength
package/consistency
readability/logic
readability/mixedcase
readability/wonkycase
syntax
whitespace/eol
whitespace/extra
whitespace/indent
whitespace/mismatch
whitespace/newline
whitespace/tabs
An example .cmakelintrc file would be as follows:
filter=-whitespace/indent
With this file in your home directory, running these commands would have the
same effect:
cmakelint.py CMakeLists.txt
cmakelint.py --filter=-whitespace/indent CMakeLists.txt
Filters can optionally be directly enabled/disabled from within a CMake file,
overriding the configuration from file or CLI argument:
```
# lint_cmake: <+ or -><filter name>
# e.g.:
# lint_cmake: -readability/wonkycase
# add multiple filters as list:
# lint_cmake: <+/-><filter1>, <+/-><filter2>
```
cmakelint can also be run with [pre-commit](https://pre-commit.com). Add the following configuration block to your `.pre-commit-config.yaml`:
``` yaml
- repo: https://github.com/cmake-lint/cmake-lint
hooks:
- id: cmakelint
```
# Output status codes
The program should exit with the following status codes:
* 0 if everything went fine
* 1 if an error message was issued
* 32 on usage error
Raw data
{
"_id": null,
"home_page": "https://github.com/cmake-lint/cmake-lint",
"name": "cmakelint",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "cmake, lint",
"author": "Richard Quirk",
"author_email": "richard.quirk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9f/46/9b6c39837be138179347611ec8cb79bf00ff3b54966ee8b63e031a05cf76/cmakelint-1.4.3.tar.gz",
"platform": null,
"description": "# CMakeLint\n\n[![Build Status](https://travis-ci.org/cmake-lint/cmake-lint.svg?branch=develop)](https://travis-ci.org/cmake-lint/cmake-lint)\n![PyPI](https://img.shields.io/pypi/v/cmakelint.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dd/cmakelint.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/cmakelint.svg)\n\ncmakelint parses CMake files and reports style issues.\n\ncmakelint requires Python.\n\n## Installation\n\nTo install cmakelint from PyPI, run:\n\n.. code-block:: bash\n\n $ pip install cmakelint\n\n## Usage\n\n Syntax: cmakelint [--config=file] [--filter=-x,+y] <file> [file] ...\n filter=-x,+y,...\n Specify a comma separated list of filters to apply\n\n config=file\n Use the given file for configuration. By default the file\n $PWD/.cmakelintrc, ~/.config/cmakelintrc, $XDG_CONFIG_DIR/cmakelintrc or\n ~/.cmakelintrc is used if it exists. Use the value \"None\" to use no\n configuration file (./None for a file called literally None) Only the\n option \"filter=\" is currently supported in this file.\n\nRun the `--filter=` option with no filter to see available options. Currently\nthese are:\n\n convention/filename\n linelength\n package/consistency\n readability/logic\n readability/mixedcase\n readability/wonkycase\n syntax\n whitespace/eol\n whitespace/extra\n whitespace/indent\n whitespace/mismatch\n whitespace/newline\n whitespace/tabs\n\nAn example .cmakelintrc file would be as follows:\n\n filter=-whitespace/indent\n\nWith this file in your home directory, running these commands would have the\nsame effect:\n\n cmakelint.py CMakeLists.txt\n cmakelint.py --filter=-whitespace/indent CMakeLists.txt\n\nFilters can optionally be directly enabled/disabled from within a CMake file,\noverriding the configuration from file or CLI argument:\n\n```\n# lint_cmake: <+ or -><filter name>\n# e.g.:\n# lint_cmake: -readability/wonkycase\n# add multiple filters as list:\n# lint_cmake: <+/-><filter1>, <+/-><filter2>\n```\n\ncmakelint can also be run with [pre-commit](https://pre-commit.com). Add the following configuration block to your `.pre-commit-config.yaml`:\n\n``` yaml\n - repo: https://github.com/cmake-lint/cmake-lint\n hooks:\n - id: cmakelint\n```\n\n# Output status codes\n\nThe program should exit with the following status codes:\n\n* 0 if everything went fine\n* 1 if an error message was issued\n* 32 on usage error\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Static code checker for CMake files",
"version": "1.4.3",
"project_urls": {
"Download": "https://github.com/cmake-lint/cmake-lint",
"Homepage": "https://github.com/cmake-lint/cmake-lint"
},
"split_keywords": [
"cmake",
" lint"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "532460911dd02598ef4e1b38ff545d1eca33c66158cdca03b20b85575acc5588",
"md5": "0ce7b2588a70e085345bdbe35025d1cf",
"sha256": "d812accc44d4b34bdf115c5be230c7d80566f333c9a4a60e81fd5a54bf953f9e"
},
"downloads": -1,
"filename": "cmakelint-1.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0ce7b2588a70e085345bdbe35025d1cf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13083,
"upload_time": "2024-05-12T10:43:34",
"upload_time_iso_8601": "2024-05-12T10:43:34.374012Z",
"url": "https://files.pythonhosted.org/packages/53/24/60911dd02598ef4e1b38ff545d1eca33c66158cdca03b20b85575acc5588/cmakelint-1.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f469b6c39837be138179347611ec8cb79bf00ff3b54966ee8b63e031a05cf76",
"md5": "abb9439a1b8fd5a300d9151fb16049ff",
"sha256": "98a1e485318b41eeaf4dee3469ca3039d4745985353ecea208d6dd2c1204c71d"
},
"downloads": -1,
"filename": "cmakelint-1.4.3.tar.gz",
"has_sig": false,
"md5_digest": "abb9439a1b8fd5a300d9151fb16049ff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 69578,
"upload_time": "2024-05-12T10:43:36",
"upload_time_iso_8601": "2024-05-12T10:43:36.391456Z",
"url": "https://files.pythonhosted.org/packages/9f/46/9b6c39837be138179347611ec8cb79bf00ff3b54966ee8b63e031a05cf76/cmakelint-1.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-12 10:43:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cmake-lint",
"github_project": "cmake-lint",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "cmakelint"
}