DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:coding_style

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:coding_style [2015-05-18 14:43]
218.50.181.98 removed
devel:coding_style [2019-01-07 20:30] (current)
phy25 [Checking for Coding Style Violations] Add 3.x standards path
Line 3: Line 3:
 There are currently no really strict rules in how the code should be formatted, but a few basic things should be attended to when adding code to DokuWiki. There are currently no really strict rules in how the code should be formatted, but a few basic things should be attended to when adding code to DokuWiki.
  
 +It should be noted that for the DokuWiki core applying of the PSR2 coding style is work in progress (branch ''​psr2''​). The rules of this coding style can be viewed at https://​www.php-fig.org/​psr/​psr-2/​.
 ===== Brackets and Indentations ===== ===== Brackets and Indentations =====
  
Line 72: Line 73:
 Link the DokuWiki coding standard to the CodeSniffer directory. ​ You may need to adjust the paths depending upon your operating system. Link the DokuWiki coding standard to the CodeSniffer directory. ​ You may need to adjust the paths depending upon your operating system.
  
 +    # PHP_CodeSniffer Version 2.x
     ln -s /​path/​to/​dokuwiki/​_cs/​DokuWiki /​usr/​share/​pear/​PHP/​CodeSniffer/​Standards/​DokuWiki     ln -s /​path/​to/​dokuwiki/​_cs/​DokuWiki /​usr/​share/​pear/​PHP/​CodeSniffer/​Standards/​DokuWiki
 +    ​
 +    # PHP_CodeSniffer Version 3.x
 +    ln -s /​path/​to/​dokuwiki/​_cs/​DokuWiki /​usr/​share/​pear/​PHP/​CodeSniffer/​src/​Standards/​DokuWiki
  
 Set DokuWiki to be the default standard. Set DokuWiki to be the default standard.
  
     phpcs --config-set default_standard DokuWiki     phpcs --config-set default_standard DokuWiki
 +
 +Note that the provided DokuWiki coding standard is for PHP_CodeSniffer 2.x. PHP_CodeSniffer 3.x has breaking changes which result in errors indicating that the interface ''​PHP_CodeSniffer_Sniff''​ was not found.
  
 === Usage === === Usage ===
devel/coding_style.1431953016.txt.gz ยท Last modified: 2015-05-18 14:43 by 218.50.181.98