-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define a coding style. #4
Comments
It is easiest to just follow PSR-1 and PSR-2 imo. |
I am building some interest in the PHPList OO rewrite. I commented a few days ago in the rest plugin and a OO rewrite I am sure will help to improve the API too. |
I must say I do have my doubts about these automated tools. With phpList3 we are signed up with StyleCI which uses phpcsfixer and it never parses correctly. I have even had it break the code and it was used to fix bugs in csfixer. But yes, presumably it's a good idea to start with validating code on a new project and considering this project has been dormant for a while that may be a good idea. |
@michield grumphp is just a runner with the ability to perform a specific task, out of all the ones available, to achieve a specific quality check, fix, etc. You dont need to use csfixer if you dont want to, but also if previously you had any problems it might be for several different reasons. I have never experienced such problems after I started following PSR2. A small note, at the beginning i didnt like the spaces VS tabs as I was using tabs years ago. However, I really value the use of a clearly defined standard. This would help the project have a clear guideline but of course it is a personal decision. Without examples it is very difficult to evaluate but for simplicity forcing checking (not fixing) PSR-2 formatting in the code is a great way to keep it consistent. I would also usually like to have phpcsfixer enabled. I have made a small effort with this PR #13 to show you how grumphp works. Pls check and let me know either here or on the PR. I can add MD documentation too if the main part of the PR is approved |
Full ACK to what @bizmate said. Coding Guidelines (where code formatting is part of - aka PSR-2) are the bare minimum for reaching code quality. Keep in mind though, that PSR-2 (and implicitly PSR-1) still only has rules for a subset of things you should set out rules for.
Other than that I can tell you that we migrated the whole TYPO3 project (3 million LOC) from our own code style to PSR-2 with various tools without bigger issues. |
Yes, I think it's fine. The main thing is how to keep it up-to-date. I will set up StyleCI on this repo, to see if that can help. From then on, we can ensure the coding style is maintained and also enforced. You'd actually really want to add hooks to block commits that do not comply with the style, so that the responsibility is passed to each developer, instead of continuously parsing the code and correcting mistakes. |
I did
but get
did you forget to push something? |
Hi @michield in my repo i used the branch PSR2 instead of master. So forgot to say to checkout that branch. https://github.com/bizmate/phpList/blob/PSR-2/composer.json#L25 If you have my repo locally you can checkout the branch and rerun composer install. I have noticed you have merged the pull request so now you should be able to do the same in the phplist original repo |
About hooks to run grumphp before commit, this can be done also within grumphp itself if you want to. |
ah, yes, but now grumphp is grumpy, because it can't find phpcs. Can't that just be another dependency? |
that is explicitly included in composer.json, in the folder you should have all the command line tools
Also try |
I got this:
G I'll figure out what's wrong. |
We'll use PSR-2 and check it with PHPCS. I'll take care of documenting this in the CONTRIBUTUNG file. |
We have to define a coding style. This will provide a clean and uniform workflow. Code review will be easier.
http://www.php-fig.org/psr/psr-1/
http://www.php-fig.org/psr/psr-2/
Useful links but we can define our custom coding style.
The text was updated successfully, but these errors were encountered: