dimanche 25 mai 2014

Normes de dev Symfony2 dans NetBeans

NetBeans, éditeur PHP (mais aussi C/C++, Java, etc) gratuit, permet de formater automatiquement le code quand on sauvegarde (CTRL + S).

Pour configurer le formatage à la sauvegarde, il faut aller dans Tools / Options / Editor / On Save, choisir PHP pour Laguage et All Lines pour Reformat et Remove Trailing Whitespace From.

Par défaut, un projet NetBeans utilisera les codes de formatages indiqués au niveau de l'éditeur (dans Tools / Options / Editor / Formatting). Mais on peut lui indiquer des codes de formatages spécifiques par projet, en faisant un click droit sur le projet, puis Properties / Formatting.

Cette configuration par projet sera sauvegardée dans nbprojet/project.properties. Voici celle qui vous permettra de respecter les normes de développement Symfony2 :
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.blankLinesAfterClass=0 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.blankLinesAfterField=0 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.blankLinesAfterOpenPHPTag=0 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.blankLinesBeforeField=0 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.classDeclBracePlacement=NEW_LINE auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.continuationIndentSize=4 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.expand-tabs=false auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.indent-shift-width=4 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.methodDeclBracePlacement=NEW_LINE auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.spaces-per-tab=4 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.tab-size=4 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.text-limit-width=120 auxiliary.org-netbeans-modules-editor-indent.text.x-php5.CodeStyle.project.text-line-wrap=none

2 commentaires: