cancel
Showing results for 
Search instead for 
Did you mean: 

Which coding standard to use for Magento 1.x

SOLVED

Which coding standard to use for Magento 1.x

Hi Everyone,

 

I just want to discuss which coding standard do you use for the Magento1.X version.

 

Actually I have to implement a code review process. For this I tried to implement static code analysis using Php_CodeSniffer.

I tested some Magento core files also with this standard but every file shows some errors.

 

I also tried with Magento ECG Coding standard Magento PHP_CodeSniffer Coding Standard but If I check Magento core files also with this I still get some errors.

phpcs --standard=Ecg F:\xampp\htdocs\mymagento\app\code\core\Mage\Catalog\Block\Product\View.php

I know that Magento 2.0 uses PSR-1 and PSR-2 but what about Magento1.X series?

 

So my question is which coding standard should I use? Zend or ECG ? Please share what you all people are using for coding standard.

(Though there are lot of articles related to this question on stackoverflow and other site, I want to know how other community members are implementing it?)

---
Problem Solved Click Accept as Solution!:Magento Community India Forum
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Which coding standard to use for Magento 1.x

Since the code has "Grown" over the years there are number of standards that have applied to the core

 

To be safe you should go on the Magento ECG Coding standard as well as using PSR-1 and PSR-2

 

Are you concerns that some code won't work? What is your goal in doing this?

View solution in original post

3 REPLIES 3

Re: Which coding standard to use for Magento 1.x

Since the code has "Grown" over the years there are number of standards that have applied to the core

 

To be safe you should go on the Magento ECG Coding standard as well as using PSR-1 and PSR-2

 

Are you concerns that some code won't work? What is your goal in doing this?

Re: Which coding standard to use for Magento 1.x

Hi @Brent W Peterson,

 

I have to implement a code review process in my team. I have to decide some process or tool to implement static code analysis so that across the team we follow some standards.

 

So I wanted to know should I rely only on one coding standard that's why I asked this question in community forum.

Because when I checked Magento core file with different coding standards I found that no single coding standard can check the code completely.Every standard give some different results.

 

 

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Which coding standard to use for Magento 1.x

At Meanbee we have a standards guide, I believe it is on GitHub if anyone can think of how to improve it in anyway. 

 

http://standards.meanbee.com/