File: format_source

package info (click to toggle)
hdf5 1.14.6%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 210,716 kB
  • sloc: ansic: 715,827; f90: 42,941; java: 38,101; sh: 23,766; xml: 18,707; cpp: 18,011; makefile: 2,423; perl: 2,383; yacc: 332; python: 262; javascript: 203; lex: 157; ruby: 24; csh: 22
file content (40 lines) | stat: -rwxr-xr-x 1,262 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# Recursively format all C & C++ sources and header files, except those in the
# 'config' directory and generated files, such as H5LTanalyze.c, etc.
#
# Note that any files or directories that are excluded here should also be
# added to the 'exclude' list in .github/workflows/clang-format-check.yml

COMMAND="clang-format"

if [ $# -eq 1 ]; then
    COMMAND="$COMMAND-$1"
fi

echo ""
echo "bin/format_source <version>"
echo ""
echo "Format the HDF5 C source using clang-format. The <version>"
echo "parameter is optional and can be used to force a specific"
echo "installed version of clang-format to be used."
echo ""

find . \( -type d -path ./config -prune -and -not -path ./config \) \
    -or \( \( \! \( \
        -name H5LTanalyze.c \
        -or -name H5LTparse.c \
        -or -name H5LTparse.h \
        -or -name H5Edefin.h \
        -or -name H5Einit.h \
        -or -name H5Emajdef.h \
        -or -name H5Emindef.h \
        -or -name H5Epubgen.h \
        -or -name H5Eterm.h \
        -or -name H5version.h \
        -or -name H5overflow.h \
        \) \) \
    -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp -or -iname *.java \) \) \
    | xargs -P0 -n1 ${COMMAND} -style=file -i -fallback-style=none

exit 0