7

I am using NetBeans 8.1 under Windows to develop/debug some CiviCRM code. Previous attempts at getting the contribution accepted ran into trouble as they failed to comply with the coding standards. I've installed PHP Code Sniffer and the Drupal standard from Coder - see https://www.drupal.org/node/1420008, but even when applied to 'vanilla' CiviCRM code throws a number of standards violations, particularly around the way comments are entered. Has anyone got any comments/thoughts?

6

Using the Drupal standards in your IDE ought to get you most of the way. For fine-tuning you can see https://wiki.civicrm.org/confluence/display/CRMDOC/PHP+Code+and+Inline+Documentation and also try out the civilint cli tool which is shipped with buildkit.

5

For IDE purposes, look at https://github.com/civicrm/coder/

This is a fork of drupal/coder which relaxes a number of conditions. (The coding practices in Civi differed from Drupal in some non-cosmetic ways -- changing them would break functional backward-compatibility.)

This is the same rule-set used by civilint, which is the script that runs the civicrm.org test bot (Github/Jenkins).

  • 1
    Tim, this is really cool! (In theory, anyway -- I haven't actually tried to use it yet, as I've already configured my IDE per the link in Coleman's answer.) I think this tool deserves a mention on said wiki page... or maybe it obviates the need for this page in the first place? – universalhandle Sep 20 '16 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.