Skip to content

Commit

Permalink
Add support for the pre-commit project
Browse files Browse the repository at this point in the history
- Adds a config file that allows users of https://pre-commit.com
  to easily add a cmake-format pre-commit hook to their git project.
  • Loading branch information
aharrison24 committed Jun 21, 2018
1 parent 2e2aff2 commit f1254e8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- id: cmake-format
name: cmake-format
description: cmake-format can format your listfiles nicely so that they don't look like crap.
entry: cmake-format
language: python
types: [file, text]
files: '(CMakeLists\.txt|\.cmake|\.cmake\.in)$'

24 changes: 24 additions & 0 deletions cmake_format/doc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,27 @@ into this:
foo(some_arg some_arg "
This string is on multiple lines
")
---------------------------
Version control integration
---------------------------

You can use `pre-commit`_ to easily add
``cmake-format`` as a pre-commit hook in your git repository. Once
you `have it installed`_, add this
to the ``.pre-commit-config.yaml`` in your repository:

.. code:: yaml
repos:
- repo: https://github.com/cheshirekow/cmake_format.git
rev: master
hooks:
- id: cmake-format
args: [--in-place]
Then run ``pre-commit install`` and the hooks will be set up.

.. _`pre-commit`: https://pre-commit.com/
.. _`have it installed`: https://pre-commit.com/#install

0 comments on commit f1254e8

Please sign in to comment.