forked from FreshRSS/FreshRSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Run shellcheck and shfmt (FreshRSS#2454)
* [CI] Run shellcheck and shfmt Cf. FreshRSS#2436 (comment) * rename * no need for disable anymore * also remove leftover indentation flags even if it makes no difference to syntax checking * define colors and reset before exit for local use
- Loading branch information
Showing
7 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
#!/bin/sh | ||
|
||
php -f ./cli/prepare.php > /dev/null | ||
php -f ./cli/prepare.php >/dev/null | ||
|
||
chown -R :www-data . | ||
chmod -R g+r . && chmod -R g+w ./data/ | ||
|
||
find /etc/php*/ -name php.ini -exec sed -r -i "\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \; | ||
find /etc/php*/ -name php.ini -exec sed -r -i "\\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \; | ||
|
||
if [ -n "$CRON_MIN" ]; then | ||
(echo "export TZ=$TZ" ; echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR") > /var/www/FreshRSS/Docker/env.txt | ||
crontab -l | sed -r "\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" | crontab - | ||
( | ||
echo "export TZ=$TZ" | ||
echo "export COPY_SYSLOG_TO_STDERR=$COPY_SYSLOG_TO_STDERR" | ||
) >/var/www/FreshRSS/Docker/env.txt | ||
crontab -l | sed -r "\\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" | crontab - | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#!/bin/sh | ||
sass --watch ansum.scss:ansum.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#!/bin/sh | ||
sass --watch mapco.scss:mapco.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# Based on https://github.com/koreader/koreader/blob/master/.ci/helper_shellchecks.sh | ||
|
||
ANSI_RED="\\033[31;1m" | ||
ANSI_GREEN="\\033[32;1m" | ||
ANSI_RESET="\\033[0m" | ||
|
||
mapfile -t shellscript_locations < <({ git grep -lE '^#!(/usr)?/bin/(env )?(bash|sh)' && git ls-files ./*.sh; } | sort | uniq) | ||
|
||
SHELLSCRIPT_ERROR=0 | ||
|
||
for shellscript in "${shellscript_locations[@]}"; do | ||
echo -e "${ANSI_GREEN}Running shellcheck on ${shellscript}" | ||
shellcheck "${shellscript}" || SHELLSCRIPT_ERROR=1 | ||
echo -e "${ANSI_GREEN}Running shfmt on ${shellscript}" | ||
if ! shfmt "${shellscript}" >/dev/null 2>&1; then | ||
echo -e "${ANSI_RED}Warning: ${shellscript} contains the following problem:" | ||
shfmt "${shellscript}" || SHELLSCRIPT_ERROR=1 | ||
continue | ||
fi | ||
if [ "$(cat "${shellscript}")" != "$(shfmt "${shellscript}")" ]; then | ||
echo -e "${ANSI_RED}Warning: ${shellscript} does not abide by coding style, diff for expected style:" | ||
shfmt "${shellscript}" | diff "${shellscript}" - || SHELLSCRIPT_ERROR=1 | ||
fi | ||
done | ||
|
||
echo -ne "${ANSI_RESET}" | ||
|
||
exit "${SHELLSCRIPT_ERROR}" |