Thursday, 5 March 2015

Some tips on checking your code in Drupal

Before I start it's worthy of note that this is not really a blog but more of a place where I copy and paste my own notes on things.  If the following is of help to anyone then thats great also.  Conversation on better techniques are also more than welcome.

There’s  a handful of different methods for checking your code.  One way is to run the ‘Code Sniffer’ from inside PHP Storm .  This is a great way to keep a running score of anything you might need to fix. 

As well as John’s notes on this here . 

and the jet brains instruction on this is here.  

Check in Project Settings > inspections > Enable ‘PHP Code Sniffer validation'

From here on you get a list of suggested changes on the right hand side.  You can see these by clicking on the yellow box and then running down the righthand side are some yellow markers; click on these for suggested code changes needed. 

Another way though is to install project/coder module on your drupal installation .  I find this easier to use; especially if you’re reviewing a module. 

No comments: