CodeIgniter Forums
CodeIgniter 3 PHP CodeSniffer - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: CodeIgniter 3 PHP CodeSniffer (/showthread.php?tid=65802)



CodeIgniter 3 PHP CodeSniffer - versalle88 - 07-26-2016

Hey,

Does anyone know of a good CodeSniffer for CodeIgniter 3? I have one for CI 2 that I may just modify as need be, but I was hoping someone may have already created one.

Cheers,



Andrew


RE: CodeIgniter 3 PHP CodeSniffer - Narf - 07-27-2016

For what?


RE: CodeIgniter 3 PHP CodeSniffer - versalle88 - 07-27-2016

(07-27-2016, 05:05 AM)Narf Wrote: For what?

For running against custom CI code and ensuring that it follows CI's style guide, coding standards, etc...

To be clear, this isn't anything that would be included with the core code. It would be for 3rd-party developers and teams to use when creating CI apps and sites.


RE: CodeIgniter 3 PHP CodeSniffer - mwhitney - 07-27-2016

I'm not aware of any significant changes to the style guide for CI3 vs. CI2, except that you need to check for ucfirst file/class names on most of the classes.


RE: CodeIgniter 3 PHP CodeSniffer - Narf - 07-28-2016

(07-27-2016, 09:59 AM)mwhitney Wrote: I'm not aware of any significant changes to the style guide for CI3 vs. CI2, except that you need to check for ucfirst file/class names on most of the classes.

Which is a functional requirement and not just a styleguide change.

You don't need to follow our styleguide in order to run CI.


RE: CodeIgniter 3 PHP CodeSniffer - mwhitney - 07-28-2016

(07-28-2016, 02:28 AM)Narf Wrote:
(07-27-2016, 09:59 AM)mwhitney Wrote: I'm not aware of any significant changes to the style guide for CI3 vs. CI2, except that you need to check for ucfirst file/class names on most of the classes.

Which is a functional requirement and not just a styleguide change.

You don't need to follow our styleguide in order to run CI.

I agree, especially since I only follow CI's style guide when I'm writing something I intend to submit to CI. However, it's much easier to do that if I have CodeSniffer configured properly, since my editor is configured to run it every time I save a file.

Although it is a functional requirement rather than a style guide change, CodeSniffer can be configured to check the file/class name to remind you of the functional requirement, so you don't go through the additional steps of attempting to load the page in your dev environment before discovering that you missed the shift key when you typed the file/class name.