mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
Fix Travis-CI build
* Fix php-cs according to https://github.com/ampache/ampache/issues/1251 to fix travis build. Use composer to force the 1.* version to be used. * Add `encoding` fixer. * Use the same set of fixers in Git commit hook and test script. * Update hooks and scripts. * Fix a braces issue detected by php-cs. Closes issue #1251.
This commit is contained in:
parent
fbbc3bd517
commit
2890aa89bf
6 changed files with 17 additions and 12 deletions
|
@ -7,12 +7,13 @@ php:
|
|||
- 7.0
|
||||
|
||||
before_install:
|
||||
- wget http://get.sensiolabs.org/php-cs-fixer.phar
|
||||
- export PATH="$PATH:$HOME/.composer/vendor/bin"
|
||||
- composer global require friendsofphp/php-cs-fixer:1.*
|
||||
|
||||
before_script:
|
||||
- chmod +x scripts/tests/syntax.sh
|
||||
- chmod +x scripts/tests/codestyle.sh
|
||||
|
||||
|
||||
script:
|
||||
- scripts/tests/syntax.sh
|
||||
- scripts/tests/codestyle.sh
|
||||
- scripts/tests/codestyle.sh
|
||||
|
|
|
@ -1801,4 +1801,3 @@ class Art extends database_object
|
|||
return true;
|
||||
}
|
||||
} // Art
|
||||
|
||||
|
|
|
@ -1233,7 +1233,9 @@ abstract class Catalog extends database_object
|
|||
$art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size);
|
||||
}
|
||||
}
|
||||
if ($inserted) break;
|
||||
if ($inserted) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
debug_event('gather_art', 'Image less than 5 chars, not inserting', 3);
|
||||
}
|
||||
|
|
|
@ -397,4 +397,3 @@ class Core
|
|||
return $tmp_dir;
|
||||
}
|
||||
} // Core
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ then
|
|||
elif hash php-cs-fixer
|
||||
then
|
||||
PHPCSFIXER="php-cs-fixer"
|
||||
else
|
||||
echo -e "\e[1;31mPlease install or download latest stable php-cs-fixer\e[00m";
|
||||
echo -e "\e[1;31mhttp://cs.sensiolabs.org/\e[00m";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
|
@ -20,7 +24,7 @@ else
|
|||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
fi
|
||||
|
||||
FIXERS='indentation,linefeed,trailing_spaces,short_tag,braces,controls_spaces,eof_ending,visibility,align_equals,concat_with_spaces,elseif,line_after_namespace,lowercase_constants'
|
||||
FIXERS='indentation,linefeed,trailing_spaces,short_tag,braces,controls_spaces,eof_ending,visibility,align_equals,concat_with_spaces,elseif,line_after_namespace,lowercase_constants,encoding'
|
||||
|
||||
ST=0 # Global exit status
|
||||
|
||||
|
@ -28,7 +32,7 @@ ST=0 # Global exit status
|
|||
for file in $(git diff-index --name-only $against); do
|
||||
echo -n "testing $file..."
|
||||
|
||||
FIXEROUT=$(php-cs-fixer fix --dry-run -v --fixers=$FIXERS "$file" | grep -P '\d\)' | sed -r "s~^.*?${file} ~~"; exit ${PIPESTATUS[0]})
|
||||
FIXEROUT=$($PHPCSFIXER fix --dry-run --diff -v --fixers=$FIXERS "$file" | grep -P '\d\)' | sed -r "s~^.*?${file} ~~"; exit ${PIPESTATUS[0]})
|
||||
FIXERST=$?
|
||||
|
||||
PARSEROUT=$(php --syntax-check "$file" 2>&1 | egrep -v 'No syntax errors|Errors parsing'; exit ${PIPESTATUS[0]})
|
||||
|
@ -40,7 +44,7 @@ for file in $(git diff-index --name-only $against); do
|
|||
elif [ $PARSERST != 0 ]; then
|
||||
echo $PARSEROUT
|
||||
else
|
||||
echo "OK "
|
||||
echo -e "\e[0;32mOK\e[00m ";
|
||||
fi
|
||||
ST=$(($ST | $FIXERST | $PARSERST))
|
||||
done
|
||||
|
|
|
@ -7,21 +7,21 @@ elif hash php-cs-fixer
|
|||
then
|
||||
PHPCSFIXER="php-cs-fixer"
|
||||
else
|
||||
echo -e "\e[1;31mPlease install or download php-cs-fixer\e[00m";
|
||||
echo -e "\e[1;31mPlease install or download latest stable php-cs-fixer\e[00m";
|
||||
echo -e "\e[1;31mhttp://cs.sensiolabs.org/\e[00m";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PHPCSFIXERARGS="fix -v --fixers="
|
||||
# Mandatory fix
|
||||
FIXERS1="indentation,linefeed,trailing_spaces,short_tag,braces,controls_spaces,visibility,align_equals,concat_with_spaces,elseif,line_after_namespace,lowercase_constants"
|
||||
FIXERS1="indentation,linefeed,trailing_spaces,short_tag,braces,controls_spaces,eof_ending,visibility,align_equals,concat_with_spaces,elseif,line_after_namespace,lowercase_constants,encoding"
|
||||
# Optionnal fix & false positive
|
||||
#FIXERS2="visibility"
|
||||
|
||||
EXIT=0
|
||||
|
||||
echo -e "\e[1;34mChecking mandatory formatting/coding standards\e[00m"
|
||||
$PHPCSFIXER $PHPCSFIXERARGS$FIXERS1 --dry-run .
|
||||
$PHPCSFIXER $PHPCSFIXERARGS$FIXERS1 --dry-run --diff .
|
||||
rc=$?
|
||||
if [[ $rc == 0 ]]
|
||||
then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue