[TASK] Add more fixers for php-cs-fixer
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Build / Scripts / cglFixMyCommit.sh
1 #!/bin/bash
2
3 #########################
4 #
5 # CGL check latest core commit.
6 #
7 # It expects to be run from the core root.
8 #
9 # To auto-fix single files, use the php-cs-fixer command directly
10 # substitute $FILE with a filename
11 #
12 ##########################
13
14 COUNTER=0
15
16 for FILE in $(git diff-tree --no-commit-id --name-only -r HEAD | grep '.php$'); do
17 if [ -e $FILE ]
18 then
19 # If changes to the fixers are done, please sync them with Build/.php_cs from core root directory
20 ./bin/php-cs-fixer fix $FILE \
21 -v \
22 --level=psr2 \
23 --fixers=remove_leading_slash_use,single_array_no_trailing_comma,spaces_before_semicolon,unused_use,concat_with_spaces,whitespacy_lines,ordered_use,single_quote,duplicate_semicolon,extra_empty_lines,phpdoc_no_package,phpdoc_scalar,no_empty_lines_after_phpdocs,short_array_syntax,array_element_white_space_after_comma,function_typehint_space,hash_to_slash_comment,join_function,lowercase_cast,namespace_no_leading_whitespace,native_function_casing,no_empty_statement,self_accessor,short_bool_cast,unneeded_control_parentheses
24 if [ "$?" = "1" ]
25 then
26 COUNTER=$((COUNTER+1))
27 fi
28 fi
29 done
30
31 if [ ${COUNTER} -gt 0 ] ; then
32 echo "$COUNTER number of files are not CGL clean. Check $0 to find out what is going wrong."
33 exit 1
34 fi
35
36 exit 0