Difference between revisions of "Coding Standards"

From Freephile Wiki
Jump to navigation Jump to search
m
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
In the PHP community, as well as every other development community, there has been a long-standing tradition of establishing 'Coding Standards' that specify how developers should format their code.  So, the [http://www.php-fig.org/ PHP Framework Interop(ability) Group] came up with [http://www.php-fig.org/psr/psr-1/ PSR-1] and [http://www.php-fig.org/psr/psr-2/ PSR-2] that deal with the issue specifically.
 
In the PHP community, as well as every other development community, there has been a long-standing tradition of establishing 'Coding Standards' that specify how developers should format their code.  So, the [http://www.php-fig.org/ PHP Framework Interop(ability) Group] came up with [http://www.php-fig.org/psr/psr-1/ PSR-1] and [http://www.php-fig.org/psr/psr-2/ PSR-2] that deal with the issue specifically.
  
== Tools ==
+
==Tools==
 
Fabien Potencier (Sensio Labs) has released the '''PHP Coding Standards Fixer''' tool which fixes most issues in your code.  It helps you follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents.
 
Fabien Potencier (Sensio Labs) has released the '''PHP Coding Standards Fixer''' tool which fixes most issues in your code.  It helps you follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents.
* [http://cs.sensiolabs.org/ PHP Coding Standards Fixer website] ([https://github.com/FriendsOfPHP/PHP-CS-Fixer code]) 
 
* Note that if you use [[NetBeans]], there is a plugin that will integrate with this tool.
 
  
Greg Sherwood (Squiz Labs) is the maintainer of '''[http://www.squizlabs.com/php-codesniffer PHP CodeSniffer]''', which was originally a PEAR project.  PHP_CodeSniffer is a PHP5 script that tokenises and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.
+
*[https://cs.symfony.com/ PHP Coding Standards Fixer website] ([https://github.com/PHP-CS-Fixer/PHP-CS-Fixer code])
* [https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage Usage]
+
*Note that if you use [[NetBeans]], there is a plugin that will integrate with this tool.
* There is a [https://packagist.org/packages/mediawiki/mediawiki-codesniffer sniff file for MediaWiki] (see [https://github.com/wikimedia/mediawiki-tools-codesniffer here]) that you can use to conform to [[mw:Manual:Coding_conventions|MediaWiki Coding Conventions]]
 
  
 +
Greg Sherwood (Squiz Labs) is the maintainer of '''[https://github.com/squizlabs/PHP_CodeSniffer PHP CodeSniffer]''', which was originally a PEAR project.  PHP_CodeSniffer tokenizes and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.
  
For users of Atom, the [https://atom.io/packages/docblockr docblockr] package makes it easy to write your Doxygen comments. Just press <kbd>tab</kbd> or <kbd>enter</kbd> after you begin typing a comment.
+
*[https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage Usage]
 +
*There is a [https://packagist.org/packages/mediawiki/mediawiki-codesniffer sniff file for MediaWiki] (see [https://github.com/wikimedia/mediawiki-tools-codesniffer here]) that you can use to conform to [[mw:Manual:Coding_conventions|MediaWiki Coding Conventions]]
 +
 
 +
=== ESLint ===
 +
[https://eslint.org/ ESLint] statically analyzes your code to quickly find problems. It is built into most text editors and you can run ESLint as part of your [[continuous integration]] pipeline.
 +
 
 +
ESLint is used as a code quality tool for the MediaWiki project, and specifically their [[Vue.js|Vue]] codebase. More at https://www.mediawiki.org/wiki/Manual:Coding_conventions/Vue
  
 
[[Category:Tools]]
 
[[Category:Tools]]

Latest revision as of 15:58, 6 November 2023

In the PHP community, as well as every other development community, there has been a long-standing tradition of establishing 'Coding Standards' that specify how developers should format their code. So, the PHP Framework Interop(ability) Group came up with PSR-1 and PSR-2 that deal with the issue specifically.

Tools[edit | edit source]

Fabien Potencier (Sensio Labs) has released the PHP Coding Standards Fixer tool which fixes most issues in your code. It helps you follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents.

Greg Sherwood (Squiz Labs) is the maintainer of PHP CodeSniffer, which was originally a PEAR project. PHP_CodeSniffer tokenizes and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

ESLint[edit | edit source]

ESLint statically analyzes your code to quickly find problems. It is built into most text editors and you can run ESLint as part of your continuous integration pipeline.

ESLint is used as a code quality tool for the MediaWiki project, and specifically their Vue codebase. More at https://www.mediawiki.org/wiki/Manual:Coding_conventions/Vue