Reindent all files

Now `make test` fails when sources are not indented correctly, the
indentation test is also executed in the CI.
This commit is contained in:
Pietro Abate 2017-11-13 16:34:00 +01:00 committed by Grégoire
parent 32a466556e
commit 6ecfca9396
112 changed files with 2096 additions and 2001 deletions

View File

@ -72,6 +72,11 @@ build:
dependencies:
- build
test:ocp-indent:
<<: *test_definition
script:
- jbuilder build @runtest_indent
test:utils:
<<: *test_definition
script:

62
jbuild
View File

@ -1 +1,63 @@
(jbuild_version 1)
(alias
((name runtest_indent)
(deps ( ;; Hack... list all directories
(glob_files scripts/*.ml)
(glob_files scripts/*.mli)
(glob_files src/*.ml)
(glob_files src/*.mli)
(glob_files src/attacker/*.ml)
(glob_files src/attacker/*.mli)
(glob_files src/client/*.ml)
(glob_files src/client/*.mli)
(glob_files src/client/embedded/alpha/*.ml)
(glob_files src/client/embedded/alpha/*.mli)
(glob_files src/client/embedded/demo/*.ml)
(glob_files src/client/embedded/demo/*.mli)
(glob_files src/client/embedded/genesis/*.ml)
(glob_files src/client/embedded/genesis/*.mli)
(glob_files src/compiler/*.ml)
(glob_files src/compiler/*.mli)
(glob_files src/environment/sigs_packer/*.ml)
(glob_files src/environment/sigs_packer/*.mli)
(glob_files src/environment/v1/*.ml)
(glob_files src/environment/v1/*.mli)
(glob_files src/micheline/*.ml)
(glob_files src/micheline/*.mli)
(glob_files src/minutils/*.ml)
(glob_files src/minutils/*.mli)
(glob_files src/node/db/*.ml)
(glob_files src/node/db/*.mli)
(glob_files src/node/main/*.ml)
(glob_files src/node/main/*.mli)
(glob_files src/node/net/*.ml)
(glob_files src/node/net/*.mli)
(glob_files src/node/shell/*.ml)
(glob_files src/node/shell/*.mli)
(glob_files src/node/updater/*.ml)
(glob_files src/node/updater/*.mli)
(glob_files src/proto/alpha/*.ml)
(glob_files src/proto/alpha/*.mli)
(glob_files src/proto/demo/*.ml)
(glob_files src/proto/demo/*.mli)
(glob_files src/proto/genesis/*.ml)
(glob_files src/proto/genesis/*.mli)
(glob_files src/utils/*.ml)
(glob_files src/utils/*.mli)
(glob_files test/lib/*.ml)
(glob_files test/lib/*.mli)
(glob_files test/p2p/*.ml)
(glob_files test/p2p/*.mli)
(glob_files test/proto_alpha/*.ml)
(glob_files test/proto_alpha/*.mli)
(glob_files test/shell/*.ml)
(glob_files test/shell/*.mli)
(glob_files test/utils/*.ml)
(glob_files test/utils/*.mli)
))
(action (run bash ${path:scripts/test-ocp-indent.sh}))))
(alias
((name runtest)
(deps ((alias runtest_indent)))))

22
scripts/test-ocp-indent.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
tmp_dir="$(mktemp -d -t tezos_build.XXXXXXXXXX)"
failed=no
for f in ` find \( -name _build -or \
-name .git -or \
-wholename ./src/environment/v1.ml -or \
-name registerer.ml \) -prune -or \
\( -name \*.ml -or -name \*.mli \) -print`; do
ff=$(basename $f)
ocp-indent $f > $tmp_dir/$ff
diff -u --color $f $tmp_dir/$ff
if [ $? -ne 0 ]; then
failed=yes
fi
rm -f $tmp_dir/$ff $tmp_dir/$ff.diff
done
if [ $failed = "yes" ]; then
exit 2
fi

View File

@ -76,7 +76,7 @@ let begin_construction
~predecessor:_
~timestamp:_
?proto_header:_ () =
Fitness.to_int64 pred_fitness >>=? function pred_fitness ->
Fitness.to_int64 pred_fitness >>=? fun pred_fitness ->
let fitness = Int64.succ pred_fitness in
return { context ; fitness }

View File

@ -26,8 +26,8 @@
../scripts/client_lib.inc.sh
(glob_files contracts/*)
))
(locks (/tcp-port/18732
/tcp-port/19732))
(locks (/tcp-port/18731
/tcp-port/19731))
(action (run bash ${path:test_contracts.sh}))))
(alias
@ -46,3 +46,9 @@
/tcp-port/19731 /tcp-port/19732 /tcp-port/19733 /tcp-port/19734
/tcp-port/19735 /tcp-port/19736 /tcp-port/19737 /tcp-port/19738))
(action (run bash ${path:test_multinode.sh}))))
(alias
((name runtest)
(deps ((alias runtest_basic.sh)
(alias runtest_contracts.sh)
(alias runtest_multinode.sh)))))

View File

@ -6,7 +6,7 @@ set -o pipefail
test_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)")"
source $test_dir/lib/test_lib.inc.sh
start_node 2
start_node 1
activate_alpha
key1=foo