Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-cli
FROM php:8.1-cli

COPY entrypoint.sh /entrypoint.sh

Expand Down
25 changes: 12 additions & 13 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ ERROR=0
PATHS=$(printf ${MODIFIED_FILES} | tr \\n '\n')


echo "******************************** MODIFIED FILES ********************************"
printf "\n******************************** MODIFIED FILES ****************************************************************"
echo ""
printf ${MODIFIED_FILES}
printf "\n********************************* ERRORS FOUND *******************************************************************"
printf "\n******************************** ERRORS FOUND ****************************************************************"

echo "$PATHS" | while read FILE ; do
while read FILE ; do

if [[ ! -f $FILE ]]; then
continue # skip deleted files
Expand All @@ -24,24 +25,22 @@ echo "$PATHS" | 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'
ERROR=1
fi
done
done <<< "$PATHS"

printf "\n**************************************************************************************************************"

if [[ $ERROR == 0 ]]; then
printf "\n* No files with wrong breakline format found in changed files"
fi

printf "\n******************************************************************************************************************\n"


if [[ $ERROR == 1 ]]; then
exit 0
else
printf "\n* There are files with wrong breakline format, please fix them (see above)"
exit 101
fi