Beautify

From Freephile Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Code is sometimes ugly. You want to make it look pretty. JS-beautify is one such tool.

For PHP, JavaScript and CSS, PHP Code Sniffer (phpcs) and its counterpart PHP Code Beautifier (phpcbf) work to ensure your code adheres to standards. For using phpcs in MediaWiki, see mw:Manual:Coding_conventions/PHP. PHPCS is enabled in ~89% of repositories hosted by WMF[1] MediaWiki Code Sniffer is the set of rules (or ruleset to be more precise) that defines the standards for the MediaWiki project.

Suffice it to say, you can composer phpcs to run the tool from the project root. For more on how to run it, see mw:Continuous_integration/PHP_CodeSniffer Documentation for PHP_CodeSniffer is at https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki

The standards available in the MediaWiki project include 'MediaWiki'
php ./vendor/bin/phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, MediaWiki, Modernize, NormalizedArrays, Universal and PHPCSUtils


References[edit]