Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Tag: 2017 source edit
Line 108: Line 108:
**Note 1: The following rule are very important to follow:
**Note 1: The following rule are very important to follow:
***Files must be saved with Unix format (LF) and not Windows (CR/LF). Unix format is compatible on all OS such as Unix like, Windows, Mac, but the Windows text file format may not work on some PHP under Unix.
***Files must be saved with Unix format (LF) and not Windows (CR/LF). Unix format is compatible on all OS such as Unix like, Windows, Mac, but the Windows text file format may not work on some PHP under Unix.
***Smart tags PHP are not used. PHP code section must start with '''<?php'''
***Smart tags PHP must not be used. PHP code section must start with '''<?php''' (smart tags, also known as short tags depend on php configuration option short_open_tag, even if this was solved after php5.4. The use of <? has conflict with XML syntax. And finally, the use of <? make easier for a hacker to make php injection. To avoid this, some Dolibarr components, like the website php editor accepts only full php tags. Finaly, using the same tag everywhere make also easier to make code scanning or impact analysis where we are sure of the tags that is used and the best solution is to use only one and the same everywhere.
**Note 2: You can use the file '''dev/setup/codesniffer/ruleset.xml''' as rule file to control coding style with PHPCodeSniffer.
**Note 2: You can use the file '''dev/setup/codesniffer/ruleset.xml''' as rule file to control coding style with PHPCodeSniffer.
**Note 3: You can use the file '''dev/setup/eclipse/PSR-12 [built-in].xml''' as rule file to setup Eclipse syntax formater.
**Note 3: You can use the file '''dev/setup/eclipse/PSR-12 [built-in].xml''' as rule file to setup Eclipse syntax formater.

Navigation menu