blob: afcf8c486232c44d2a092634ec43fb87238294b9 [file] [log] [blame]
Andrew Geissler7d6e6292018-05-24 12:06:58 -07001#!/bin/bash
2
3# This script reformats source files using the clang-format utility.
4#
5# Files are changed in-place, so make sure you don't have anything open in an
6# editor, and you may want to commit before formatting in case of awryness.
7#
8# This must be run on a clean repository to succeed
9
10DIR=$(pwd)
11cd ${DIR}
12
13set -e
14
15echo "Formatting code under $DIR/"
16
17# Only validate certain areas of the code base for
18# formatting due to some imported code in webui
19
20if [ -f ".clang-format" ]; then
Gunnar Mills4ddda582018-09-04 09:18:30 -050021 clang-format-6.0 -i `git ls-files '*.js'`
Andrew Geissler7d6e6292018-05-24 12:06:58 -070022 git --no-pager diff --exit-code
23fi