Skip to content

Commit 483200a

Browse files
Kevinjilvmcj
authored andcommitted
Fix syntax-check errors
As the CI job was not correctly run for some time, a lot of small errors were in the repository.
1 parent 2a18911 commit 483200a

File tree

9 files changed

+33
-26
lines changed

9 files changed

+33
-26
lines changed

.github/jobs/syntax-check

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if [ ! -x /usr/bin/shellcheck ]; then
2525
fi
2626

2727
find . \( \
28-
-path ./webapp/vendor -prune \
28+
-path ./webapp/vendor -prune \
2929
-o -path ./webapp/var -prune \
3030
-o -path ./output -prune \
3131
-o -path ./.git -prune \
@@ -34,7 +34,8 @@ find . \( \
3434
-o -type f \) \
3535
-a -type f | \
3636
while read -r i ; do
37-
if [[ "$i" == *\.php ]] || grep -q "^#\\!.*php" "$i"; then
37+
if [[ "$i" == *\.php ]] || grep -q "^#\\!.*php" "$i" && \
38+
echo "$i" | grep -qvE '(^\./(webapp/resources/adminer)\.php)'; then
3839
$PHP -l "$i" | sed -e 's|No syntax errors detected in ./|check PHP syntax: |'
3940
if [[ "$i" == *\.php ]] && [ "$i" != "./webapp/config/bundles.php" ] && ! head -1 "$i"|grep -q "strict_types"; then
4041
echo "PHP file missing strict types declaration: $i"

misc-tools/dj_make_chroot.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ if [ "$DISTRO" = 'Ubuntu' ]; then
234234
# x86(_64) can use the main Ubuntu repo's, other
235235
# architectures need to use a mirror from ubuntu-ports.
236236
MAINSTREAM="amd64 i386"
237-
if [ -z "${MAINSTREAM##*$ARCH*}" ]; then
237+
if [ -z "${MAINSTREAM##*"$ARCH"*}" ]; then
238238
DEBMIRROR="http://us.archive.ubuntu.com/ubuntu/"
239239
else
240240
DEBMIRROR="http://ports.ubuntu.com/ubuntu-ports/"
@@ -321,6 +321,7 @@ fi
321321

322322
# Add indication to interactive shell that the user is in the chroot
323323
for bashrc in "root/.bashrc" "etc/bash.bashrc"; do
324+
# shellcheck disable=SC2016
324325
echo 'PS1=(chroot)$PS1' >> "$CHROOTDIR/$bashrc"
325326
done
326327

misc-tools/dj_run_chroot.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Abort when a single command fails:
1111
set -e
1212

13+
# shellcheck disable=SC2317
1314
cleanup() {
1415
# Unmount things on cleanup
1516
umount -f "$CHROOTDIR/proc" >/dev/null 2>&1 || /bin/true

sql/dj_setup_database.in

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,22 @@ EOF
5353

5454
mysql_options()
5555
{
56-
local user pass
57-
5856
# shellcheck disable=SC2153
5957
if [ -n "$DBUSER" ]; then
60-
user="-u $DBUSER"
58+
_user="-u $DBUSER"
6159
else
62-
user="${DBA_USER:+-u ${DBA_USER}}"
60+
_user="${DBA_USER:+-u ${DBA_USER}}"
6361
fi
6462
# shellcheck disable=SC2153
6563
if [ -n "$PASSWD" ]; then
66-
pass="-p$PASSWD"
64+
_pass="-p$PASSWD"
6765
else
68-
[ -n "$PROMPT_PASSWD" ] && pass="-p"
69-
[ -n "$DBA_PASSWD" ] && pass="-p$DBA_PASSWD"
66+
[ -n "$PROMPT_PASSWD" ] && _pass="-p"
67+
[ -n "$DBA_PASSWD" ] && _pass="-p$DBA_PASSWD"
7068
fi
7169

7270
[ -z "$USE_SOCKET" ] && port="-P$DBPORT"
73-
echo $user ${pass:+"$pass"} -h "$DBHOST" ${port:+"$port"}
71+
echo $_user ${_pass:+"$_pass"} -h "$DBHOST" ${port:+"$port"}
7472
}
7573

7674
# Wrapper around mysql command to allow setting options, user, etc.
@@ -363,7 +361,7 @@ upgrade)
363361
# Check if we need to upgrade the Doctrine migrations table
364362
if ! echo "SHOW CREATE TABLE \`doctrine_migration_versions\`" | mysql "$DBNAME" >/dev/null 2>&1; then
365363
symfony_console doctrine:migrations:sync-metadata-storage -n
366-
# shellcheck disable=SC2016
364+
# shellcheck disable=SC2016,SC2028
367365
echo 'INSERT INTO `doctrine_migration_versions`
368366
(version, executed_at, execution_time)
369367
SELECT concat("DoctrineMigrations\\\\Version", version), executed_at, 1
@@ -386,7 +384,8 @@ dump)
386384

387385
if [ -f "${DATABASEDUMPDIR}/${DUMPNAME}.sql.gz" ]; then
388386
while true; do
389-
read -p "Overwrite existing database dump (y/N)? " yn
387+
printf "Overwrite existing database dump (y/N)? "
388+
read -r yn
390389
case $yn in
391390
[Yy]* ) break ;;
392391
''|[Nn]* ) exit 0;;
@@ -407,19 +406,20 @@ load)
407406
exit 1
408407
fi
409408
ind=1
410-
for i in "$databases"; do
409+
for i in $databases; do
411410
echo "$ind) $i"
412-
: $((ind+=1))
411+
ind=$((ind+1))
413412
done
414413
while true; do
415-
read -p "Which database should be loaded? " db
414+
echo "Which database should be loaded? "
415+
read -r db
416416
ind=1
417-
for i in "$databases"; do
417+
for i in $databases; do
418418
if [ "$ind" = "$db" ]; then
419419
FILE="$i"
420420
break
421421
fi
422-
: $((ind+=1))
422+
ind=$((ind+1))
423423
done
424424
if [ -n "$FILE" ]; then
425425
break

sql/files/defaultdata/r/run

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ fi
3030
#
3131
# Store intermediate files in the current dir (/compile) as its only
3232
# available during compilation step.
33-
export TMPDIR=`pwd`
34-
Rscript -e "parse('"$@"')"
35-
EXITCODE=$?
36-
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
33+
TMPDIR=`pwd`
34+
export TMPDIR
35+
for f in "$@"
36+
do
37+
Rscript -e "parse('$f')"
38+
EXITCODE=$?
39+
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
40+
done
3741

3842
# Write executing script:
3943
cat > "$DEST" <<EOF

sql/files/defaultdata/swift/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ while [ $# -gt 0 ]; do
2323
if [ "x${1%.swift}" != "x$1" ]; then
2424
SOURCE="$1"
2525
[ -z "$MAINSOURCE" ] && MAINSOURCE="$1"
26-
if [ "x$SOURCE" = "x$MAINSOURCE" ] && [ "x$MAINSOURCE" != "xmain.swift" ]; then
26+
if [ "$SOURCE" = "$MAINSOURCE" ] && [ "$MAINSOURCE" != "main.swift" ]; then
2727
if [ -f "main.swift" ]; then
2828
echo "main.swift exists but is not the main source; not allowed by Swift compiler"
2929
exit 1

webapp/config/preload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
44
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';

webapp/src/Utils/EventFeedFormat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace App\Utils;
44

webapp/tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
use Symfony\Component\Dotenv\Dotenv;
44

0 commit comments

Comments
 (0)