Monday, February 17, 2014

PHP Code Analysis with NetBeans 7.4

NetBeans has become my IDE of choice for PHP in the last year or so. Version 7.4 shipped with support for code analysis tools with PHP, namely PHPMD and PHP_CodeSniffer. Unfortunately, usage of these tools within the IDE is not well documented, so I wanted to share how they work.

Configuration

Installing the tools is up to you; NetBeans just uses the scripts you point to. I prefer using composer's global option, but if you prefer PEAR or some other installation method, that's fine too.

Once installed, navigate to "Tools > Options > PHP > Code Analysis" inside of NetBeans and configure the paths to the scripts and the default rules you want to use.

Running

Now here's the part nobody really tells you: how to actually use these tools. From inside of NetBeans, navigate to "Source > Inspect..."

That's pretty much it. Select the scope and and configuration to use and click "Inspect." If you configured everything correctly, the scripts will run and after a few seconds (or minutes, depending on project size) you'll be presented with a nice results view.

Ignore Folders

You may want to instruct the IDE to ignore certain folders when running code analysis. For example, I use Composer to manage dependencies, and I don't want to see results for everything under my vendor directory. To ignore vendors, right-click on the project in the project pane and navigate to "Properties > Ignored Folders" and add the vendors folder under "Extra Folders for Code Analysis."

37 comments:

  1. I get a lot of great information from this blog. Thank you for your sharing this informative blog. Recently I did PHP course at a leading academy. If you are looking for best PHP Training Institute in Chennai visit FITA IT training academy which offer real timePHP Training in Chennai.

    ReplyDelete

  2. Hi, Thanks for sharing this valuable blog.I was really impressed by reading this blog. I did HTML5 Courses in Chennai at reputed HTML5 Training Institutes in Chennai. This is really useful for me to make a bright future in designing field.

    ReplyDelete
  3. These all are notable facts… I stick with responsive website design for my business. With the mobile marketing is at its peak stage, having website that goes comfy on all devices will help your business. You can check my website for more details on the importance of responsive website design. PHP Training in Chennai | Best PHP training in Chennai | PHP Training Institute in Chennai

    ReplyDelete
  4. Thanks for sharing this information. Java is one of the popular object oriented programming language used for many of the multinational corporation. So learning Java Course in Chennai is really helpful to make a bright future.

    ReplyDelete
  5. Oracle is a relational database management system produced by oracle corporation. Nowadays most of the multinational companies used this oracle database for storing and managing their data's and programs. So learning Oracle Training Chennai is one of the best idea to make a bright career.

    ReplyDelete
  6. Thanks for sharing this information. Salesforce is a cloud based CRM. Nowadays most of the multinational companies used this CRM for managing their customers. To know more details call 9841746595.

    Regards..
    Salesforce Training in Chennai

    ReplyDelete
  7. Nice Post. Testing is a process of executing a program in order to find any errors, missing requirement or gaps to the original requirements.
    Regards...
    Software Testing Training Institutes in Chennai

    ReplyDelete
  8. I use Composer to manage dependencies, and I don't want to see results for everything under my vendor directory. denver hvac

    ReplyDelete
  9. Thanks for your informative article on software testing. Your post helped me to understand the future and career prospects in software testing. Keep on updating your blog with such awesome article. Software testing course in Chennai| Software testing training in Chennai

    ReplyDelete
  10. Great article. I glad to found your blog. I gained some knowledge about PHP. Thanks for sharing.
    php training in chennai

    ReplyDelete
  11. You should know the where to find the most professional resume writing sites reviews to know which company is the best for you and your resume. As today the thing is that many companies only name their selves as writing ones but actually that is not so.

    ReplyDelete
  12. I am happy to found such helpful and fascinating post that is written in well manner.
    Regards..
    QTP Training in Chennai | Software Testing Training in Chennai

    ReplyDelete
  13. The best thing about HTML5 is that it allows the developers to embed the video files, audio files, and high quality graphics without any third party applications.
    html5 training in chennai | html5 training institutes in chennai | Fita Chennai reviews

    ReplyDelete
  14. Really awesome blog. Your blog is really useful for me.
    Thanks for sharing this informative blog. Keep update your blog.
    Oracle Training In Chennai

    ReplyDelete
  15. Best Java Training Institute In ChennaiThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

    ReplyDelete
  16. Nice concept. This is useful to me. Thanks for sharing.

    Custom PHP development Company

    ReplyDelete
  17. This is some great information. i really liked it.

    apartments at Nungambakkam

    ReplyDelete
  18. I am really like this article it is useful and informative thanks or sharing this information.


    software testing training in chennai

    ReplyDelete
  19. I read your article. It is very useful. Thanks for sharing.

    html training in chennai

    ReplyDelete
  20. your php postings are really awesome it is really good and nice and explanatory thanks for sharing

    php Training in Chennai

    ReplyDelete
  21. PHP is the best language to develop data driven websites. PHP is used by majority of the ecommerce websites. Learning PHP can give you a great future for sure.
    PHP training in Chennai | PHP course in Chennai | PHP training institute in Chennai

    ReplyDelete
  22. Dot net is a Microsoft product so it is the best language to develop applications for windows and it is supported well on the windows platform. Dot net is prefferd globally and a renowned platform with lots of job opportunities.
    Dot net training in Chennai | .NET training in Chennai | Dot net course in Chennai

    ReplyDelete
  23. I have completely read your post and the content is crisp and clear.Thank you for posting such an informative article, I have decided to follow your blog so that I can myself updated.
    Android training in Chennai | Android course in Chennai | Android training institute in Chennai

    ReplyDelete
  24. Thanks for sharing with us that awesome article you have amazing blog.....
    http://hadooptraininginhyderabad.co.in/salesforce-training-in-hyderabad/

    ReplyDelete
  25. I have definitely picked up anything new from right here. I did however expertise a few technical points using this site, since I experienced to reload the web site a lot of times previous to I could get it to load correctly.

    Corporate Training in Chennai

    ReplyDelete
  26. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    Digital Marketing Company in Chennai

    ReplyDelete
  27. This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good. We are sowing seeds and need to be patiently wait till it blossoms.




    Best Android Training Institute in Chennai

    ReplyDelete
  28. Great article. I learned some new things. Thanks for sharing.

    web design training institute in Chennai

    ReplyDelete
  29. Great article. I learned some new things. Thanks for sharing.
    PHP training in chennai

    ReplyDelete
  30. Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
    seo company in india
    digital marketing company in india
    seo company in chennai
    digital marketing company in chennai

    ReplyDelete
  31. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

    ReplyDelete
  32. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    SEO Company in India|Digital Marketing Company in Chennai

    ReplyDelete