Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/scripts/check_if_all_files_indented.sh
900 views
1
#!/bin/bash
2
3
# This file is part of t8code.
4
# t8code is a C library to manage a collection (a forest) of multiple
5
# connected adaptive space-trees of general element classes in parallel.
6
#
7
# Copyright (C) 2023 the developers
8
#
9
# t8code is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# t8code is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with t8code; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23
24
# This script checks whether all .c .h .cxx and .hxx
25
# files in t8code are properly indented.
26
#
27
# Returns 0 if yes and not 0 if not.
28
#
29
30
#
31
# This script must be executed from the scripts/ folder.
32
#
33
if [ `basename $PWD` != scripts ]
34
then
35
if [ -d scripts ]
36
then
37
# The directory stack is automatically reset on script exit.
38
pushd scripts/ > /dev/null
39
else
40
echo ERROR: scripts/ directory not found.
41
exit 1
42
fi
43
fi
44
45
# Find all files with the appropriate suffix.
46
# Excluding the sc/ and p4est/ subfolders.
47
files=`./find_all_source_files.sh`
48
49
notallindented=0
50
for file in $files
51
do
52
# Find also gives us directories,
53
# so we ensure that $file is a proper
54
# file before checking for indentation.
55
if [ -f $file ]
56
then
57
./check_if_file_indented.sh $file > /dev/null 2>&1
58
status=$?
59
if test $status -ne 0
60
then
61
echo "File $file is not indented."
62
notallindented=1
63
fi
64
fi
65
done
66
67
if test $notallindented -eq 0
68
then
69
echo All files are indented.
70
fi
71
72
exit $notallindented
73
74