Skip to content
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

PHP Standards Recommendations #6186

Open
gnovaro opened this issue Dec 17, 2016 · 6 comments
Open

PHP Standards Recommendations #6186

gnovaro opened this issue Dec 17, 2016 · 6 comments
Labels

Comments

@gnovaro
Copy link
Contributor

@gnovaro gnovaro commented Dec 17, 2016

Feature Request

Improve code style and make refactoring according current standart PHP community practices

For more info read this
http://www.php-fig.org/

You can run
http://cs.sensiolabs.org/

php-cs-fixer

@marcosgdf

This comment has been minimized.

Copy link
Contributor

@marcosgdf marcosgdf commented Dec 21, 2016

This issue has been discussed lots of times.

Project manager wants us to follow a non-strict PSR-2 with "tabs" as tabulation method. https://wiki.dolibarr.org/index.php/Language_and_development_rules

Also there is no(t any will to) control of following CS when accepting Pull Requests so the effort can sometimes be a waste of time. Also a full CS cannot be made because it will cause so much conflicts in currently reviewed Pull Requests and when merging fixes from current versions to older ones.

@rdoursenaud

This comment has been minimized.

Copy link
Member

@rdoursenaud rdoursenaud commented Jan 16, 2017

Please search the developer's mailing list before such suggestions. This is no small task and requires community approval.
As @marcosgdf already said, this has been discussed at length and settled on the current compromise.
If you want to argue, bring the discussion to the mailing list ;)

@ruistrecht-alt

This comment has been minimized.

Copy link
Contributor

@ruistrecht-alt ruistrecht-alt commented Mar 29, 2018

@rdoursenaud if we use automatic cs fixer tools like php-cs-fixer from http://cs.sensiolabs.org/
This can be done in minutes, hours if we want to thorough test everything.
Furthermore php-cs-fixer can be run as a composer command in the composer.json script, which means we can setup an automatic CS fixer on demand.

@marcosgdf "Project manager wants us to follow a non-strict PSR-2 with "tabs" as tabulation method."
We can create custom rules, as we see fit, we are not obliged to follow strict PSR-2 or PSR-1.

I think this has potential and 2nd @gnovaro suggestion. Where is the developer's mailing list by the way?

@marcosgdf

This comment has been minimized.

Copy link
Contributor

@marcosgdf marcosgdf commented Mar 29, 2018

@jtraulle

This comment has been minimized.

Copy link
Member

@jtraulle jtraulle commented Aug 28, 2018

Just wanted to add that @stickler-ci https://stickler-ci.com/ can be plugged-in to github pull requests to check and enforce a particular CS. It is free for open source projects and has even an autofix feature that can automatically push a "fix" commit to the pull request branch when some "dumb" formatting issues can be fixed automatically (tabs/spaces, missing spaces, empty lines, etc.) Maybe it worth a try 😉

@eldy

This comment has been minimized.

Copy link
Member

@eldy eldy commented Jan 16, 2019

Fixes on code to reach PSR 2 have started few years ago. And we add more rules into the offficial CI tester of project at each version (example, in v9, a dozen of new rules were fixed into all the code and introduced into dev/setup/codesniffer/ruleset.xml).
However, we add them step by step, to avoid to have too many mass changes in source code source, because this make automatic merges blocked too often when mergind old maintenance version on new version to not loose bug fixes submited on old version. This is very important for a project that is very active even of old version like Dolibarr is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.