Ticket #3810: keep panelization while switching panel listing mode.
[midnight-commander.git] / maint / utils / check-indent.sh
blobdaa612ad323165880259c73fd67d64f6c6f1154e
1 #!/bin/bash
3 # Midnight Commander - check source code indentation
5 # Copyright (C) 2015
6 # The Free Software Foundation, Inc.
8 # Written by:
9 # Slava Zanko <slavazanko@gmail.com>, 2015
11 # This file is part of the Midnight Commander.
13 # The Midnight Commander is free software: you can redistribute it
14 # and/or modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation, either version 3 of the License,
16 # or (at your option) any later version.
18 # The Midnight Commander is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 set -e
27 set -x
29 findUnindentedFiles() {
30 local directory=$1
31 find "${directory}" -name '*.[ch]' -print0 | \
32 xargs -0 indent \
33 --gnu-style \
34 --format-first-column-comments \
35 --indent-level4 \
36 --brace-indent0 \
37 --line-length100 \
38 --no-tabs \
39 --blank-lines-after-procedures
40 return $(git ls-files --modified | wc -l)
43 ( findUnindentedFiles "lib" && findUnindentedFiles "src" && findUnindentedFiles "tests" ) || {
44 echo "Sources not indented"
45 git ls-files --modified
46 exit 1