Skip to main content

CMakeLint

Build Status PyPI PyPI - Downloads PyPI - Downloads

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. Add the following configuration block to your .pre-commit-config.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

Metadata

Release files for cmakelint 1.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmakelint 1.4.3
File Size Uploaded
cmakelint-1.4.3.tar.gz 69.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmakelint 1.4.3
File Interpreter ABI Platform
cmakelint-1.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 82.7 kB

Release files / cmakelint-1.4.3.tar.gz

Download URL cmakelint-1.4.3.tar.gz
Size 69.6 kB
Tags Source
SHA-256 checksum
How to use checksums
98a1e485318b41eeaf4dee3469ca3039d4745985353ecea208d6dd2c1204c71d
BLAKE2b-256 checksum
How to use checksums
9f469b6c39837be138179347611ec8cb79bf00ff3b54966ee8b63e031a05cf76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release files / cmakelint-1.4.3-py3-none-any.whl

Download URL cmakelint-1.4.3-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d812accc44d4b34bdf115c5be230c7d80566f333c9a4a60e81fd5a54bf953f9e
BLAKE2b-256 checksum
How to use checksums
532460911dd02598ef4e1b38ff545d1eca33c66158cdca03b20b85575acc5588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4

2 release files

1.3.4.1

1 release file

1.3.4

3 release files

1.3.3.1

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3

1 release file

1.2.01

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page