N°8796 - Add PHP code style validation in iTop and extensions#62
N°8796 - Add PHP code style validation in iTop and extensions#62
Conversation
|
Ew, spaces for indentation? 😱 Current docs luckily still say to use tabs. |
thanks for this feedback. good catch! |
Hipska
left a comment
There was a problem hiding this comment.
Looks much better now, some minor comments/suggestions.
| if (in_array($sHeader, $aField['columns'])) return true; | ||
| if (in_array($sHeader, $aField['columns'])) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Single line if-return should be allowed?
There was a problem hiding this comment.
nice to have but tricky to configure
PHP-CS-Fixer/PHP-CS-Fixer#2780
| $sResult = self::CallItopViaHttp( | ||
| "/synchro/synchro_exec.php?login_mode=$sLoginform", | ||
| $aData | ||
| ); |
There was a problem hiding this comment.
What about
| $sResult = self::CallItopViaHttp( | |
| "/synchro/synchro_exec.php?login_mode=$sLoginform", | |
| $aData | |
| ); | |
| $sResult = self::CallItopViaHttp("/synchro/synchro_exec.php?login_mode=$sLoginform", $aData); |
| Utils::Log(LOG_ERR, | ||
| "[".get_class($this)."] defaults section configuration is not correct. please see documentation."); | ||
| Utils::Log( | ||
| LOG_ERR, | ||
| "[".get_class($this)."] defaults section configuration is not correct. please see documentation." | ||
| ); |
There was a problem hiding this comment.
Similar here (and other Utils::Log calls), why can't it just be on 1 line? It's not that complicated to see what's happening?
There was a problem hiding this comment.
thanks for your suggestions. for now we will keep same settings with iTop repository.
There was a problem hiding this comment.
Please don’t do it like that on iTop code as well 😢
There was a problem hiding this comment.
your suggestion makes sense. I understand your deception. but we have to move forward. having a code formatting tool in place on all our repositores seems important to our team. even if we could do better, this will ease PR reviews.
we will focus on the substance and not the form hopefully! especially for those who add or remove (whatever) EOL at the end of files....
feel free to propose an enhancement on php-cs-fixer settings.
Current PR aims at validating code style easily via php-cs-fixer.
this tool is also integrated into Jenkins pipeline along to phpstan/phpunit.
Jenkins steps have been reordered logically (code style/phpstan/phpunit).
report generated in Jenkins is in verbose. you can have it by calling:
whole code base has been re-formatted. style will be clean starting with this PR.