You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the PHP files are being formatted, it seems that they do not use our code standard set inside phpcs.xml
For example, arrays that uses the short syntax [] has been replaced by array(). If I understood correctly, it shouldn't be the case as we exclude this rule here)
The indentation is also not set to 2 space, which I think should be the case according to the rules we have here
I'm not sure what the issue is, but I tried to add -e to the command here to see what is being load, and it seems that we don't have any code standard from inside the wpcs folder:
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz and Zend
(I saw the comment here, so maybe it's related and it's a known issue but I thought I will create an issue in case it's not the case)
The text was updated successfully, but these errors were encountered:
Ah, good catch - I appreciate the detailed description.
I changed the tool to output the command-line arguments passed to the formatter, and confirmed that our custom rules in phpcs.xml are being loaded with the --standard option.
And also updated the WordPress code standard rules (4de08a3). Then I searched around in the defined rules in wpcs/Universal and wpcs/WordPress to find anything related.
There's no opposite rule to always use short syntax and convert array() to [], which is what I would have preferred.
For the indentation, I adjusted a few things (9783fb3) but the key change was to add:
<propertyname="exact"value="true"/>
That fixes indentation as expected.
The roll format command uses this PHP Beautify tool for PHP code, and Prettier for JavaScript/TypeScript and Sass. The original idea for that command was to format all our code regularly. To be honest I haven't been using it as much as I'd planned, so I'm glad to see you're trying to use it.
When I created it I was inspired by the Go language's standard formatter, which I've heard a lot of people enjoy because it removes the need to decide or discuss details of code syntax. Everyone just uses the formatter with the same rules, and the code is consistent across all projects.
I published version 1.1.0 of the NPM package @tangible/php-beautify. That should work as expected.
I was trying to run the
roll format
command of the roller (from this repository), which will then run phpBeautify if installedWhile the PHP files are being formatted, it seems that they do not use our code standard set inside phpcs.xml
For example, arrays that uses the short syntax
[]
has been replaced byarray()
. If I understood correctly, it shouldn't be the case as we exclude this rule here)The indentation is also not set to 2 space, which I think should be the case according to the rules we have here
I'm not sure what the issue is, but I tried to add
-e
to the command here to see what is being load, and it seems that we don't have any code standard from inside the wpcs folder:(I saw the comment here, so maybe it's related and it's a known issue but I thought I will create an issue in case it's not the case)
The text was updated successfully, but these errors were encountered: