Code Monkey home page Code Monkey logo

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

cmake-lint's Projects

cmake-lint icon cmake-lint

Fork of https://github.com/richq/cmake-lint to continue maintenance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.