From 3dd4971281a8dca32f9314481e9330cca5487d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Hub=C3=A1=C4=8Dek?= Date: Mon, 17 Oct 2022 23:49:47 +0200 Subject: [PATCH 1/8] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3aa2204..949d175 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.4-cli +FROM php:8.1-cli COPY entrypoint.sh /entrypoint.sh From 1498ccccb7bb0d8aacc672770672dcef26242b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 16:22:37 +0100 Subject: [PATCH 2/8] Fix scope variable --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6db0567..0de768a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,7 @@ echo "******************************** MODIFIED FILES ************************** printf ${MODIFIED_FILES} printf "\n********************************* ERRORS FOUND *******************************************************************" -echo "$PATHS" | while read FILE ; do +ERROR=$(echo "$PATHS" | (while read FILE ; do if [[ ! -f $FILE ]]; then continue # skip deleted files @@ -33,7 +33,7 @@ echo "$PATHS" | while read FILE ; do cat -en $FILE | grep "\^M" | sed 's/\^M\$//g' ERROR=1 fi -done +done && echo $ERROR)) if [[ $ERROR == 0 ]]; then printf "\n* No files with wrong breakline format found in changed files" From 90702355cae74094703e47c59df7279991dc0a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 16:49:03 +0100 Subject: [PATCH 3/8] fix more --- entrypoint.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0de768a..f7a8b5f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,11 +4,11 @@ ERROR=0 PATHS=$(printf ${MODIFIED_FILES} | tr \\n '\n') -echo "******************************** MODIFIED FILES ********************************" +printf "\n******************************** MODIFIED FILES ****************************************************************" printf ${MODIFIED_FILES} -printf "\n********************************* ERRORS FOUND *******************************************************************" +printf "\n******************************** ERRORS FOUND ****************************************************************" -ERROR=$(echo "$PATHS" | (while read FILE ; do +while read FILE ; do if [[ ! -f $FILE ]]; then continue # skip deleted files @@ -31,17 +31,11 @@ ERROR=$(echo "$PATHS" | (while read FILE ; do if [[ $CR_LINE_DETECTOR == 1 ]]; then echo "\n* $BREAKLINE_TYPE line breaker found in $FILE:" cat -en $FILE | grep "\^M" | sed 's/\^M\$//g' - ERROR=1 fi -done && echo $ERROR)) +done <<< "$(echo -e "$MODIFIED_FILES")" if [[ $ERROR == 0 ]]; then - printf "\n* No files with wrong breakline format found in changed files" -fi - -printf "\n******************************************************************************************************************\n" - - -if [[ $ERROR == 1 ]]; then + printf "\n* No files with wrong breakline format found in changed files" +else exit 101 fi From 8d76fe10b5531332f8b29f7e41e70add60d53cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 16:51:50 +0100 Subject: [PATCH 4/8] formatting --- entrypoint.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f7a8b5f..5962f79 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,18 +24,20 @@ while read FILE ; do BREAKLINE_TYPE=$(find $FILE -not -type d -exec file "{}" ";" | grep -o "CR\(LF\)\?") if [[ $CR_FOUND == 1 ]]; then - echo "\n* Whole file( $FILE ) breakline format is $BREAKLINE_TYPE , it should be LF" + printf "\n* Whole file( $FILE ) breakline format is $BREAKLINE_TYPE , it should be LF" ERROR=1 fi if [[ $CR_LINE_DETECTOR == 1 ]]; then - echo "\n* $BREAKLINE_TYPE line breaker found in $FILE:" + printf "\n* $BREAKLINE_TYPE line breaker found in $FILE:" cat -en $FILE | grep "\^M" | sed 's/\^M\$//g' fi done <<< "$(echo -e "$MODIFIED_FILES")" if [[ $ERROR == 0 ]]; then - printf "\n* No files with wrong breakline format found in changed files" + printf "\n* No files with wrong breakline format found in changed files" + exit 0 else + printf "\n* There are files with wrong breakline format, please fix them (see above)" exit 101 fi From 21d416f0c92ac9ec45780cc8ceb9897c4d8f7764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 17:04:42 +0100 Subject: [PATCH 5/8] Update entrypoint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Luboš Hubáček --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5962f79..65f6e2b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,7 +32,7 @@ while read FILE ; do printf "\n* $BREAKLINE_TYPE line breaker found in $FILE:" cat -en $FILE | grep "\^M" | sed 's/\^M\$//g' fi -done <<< "$(echo -e "$MODIFIED_FILES")" +done <<< $PATHS" if [[ $ERROR == 0 ]]; then printf "\n* No files with wrong breakline format found in changed files" From f6a511bbc17389d055d4b318e9cb6428a87bca19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 17:05:40 +0100 Subject: [PATCH 6/8] Update entrypoint.sh --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 65f6e2b..463ae7b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,7 +32,7 @@ while read FILE ; do printf "\n* $BREAKLINE_TYPE line breaker found in $FILE:" cat -en $FILE | grep "\^M" | sed 's/\^M\$//g' fi -done <<< $PATHS" +done <<< "$PATHS" if [[ $ERROR == 0 ]]; then printf "\n* No files with wrong breakline format found in changed files" From bcec4b265219ff3c8f110bd16fca7ebeb7f42bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 17:09:59 +0100 Subject: [PATCH 7/8] Update entrypoint.sh --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 463ae7b..0d8be36 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,7 @@ PATHS=$(printf ${MODIFIED_FILES} | tr \\n '\n') printf "\n******************************** MODIFIED FILES ****************************************************************" +echo "" printf ${MODIFIED_FILES} printf "\n******************************** ERRORS FOUND ****************************************************************" From 167b49626cb8be6d8ee9051c2ff1e4001a36310b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1?= Date: Mon, 12 Dec 2022 17:16:29 +0100 Subject: [PATCH 8/8] Update entrypoint.sh --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0d8be36..5c94a32 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,7 +7,7 @@ PATHS=$(printf ${MODIFIED_FILES} | tr \\n '\n') printf "\n******************************** MODIFIED FILES ****************************************************************" echo "" printf ${MODIFIED_FILES} -printf "\n******************************** ERRORS FOUND ****************************************************************" +printf "\n******************************** ERRORS FOUND ****************************************************************" while read FILE ; do @@ -35,6 +35,8 @@ while read FILE ; do fi done <<< "$PATHS" +printf "\n**************************************************************************************************************" + if [[ $ERROR == 0 ]]; then printf "\n* No files with wrong breakline format found in changed files" exit 0