Open dakanji opened 12 years ago
Should you consider to deal with all the changes in just one PR? Or do you prefer to split the issue in one PR per bullet?
Hi,
Probably best to do things in small chunks although some of these may be interdependent.
Try to pull from dev once again before starting as I have updated the style to avoid conflicts. I will shortly update the contributing md file on steps to take to align coding style with a pre-commit hook
Great! I am using PHPStorm as of now and I found it difficult to align the style... I will appreciate any tools or suggestions :)
It is basically PSR 2 with tabs for indentation and spaces for alignment.
Working on making this easier to adopt using composer but I need to test.
You could temporarily do the following:
- composer global require "squizlabs/php_codesniffer=*"
- composer global require friendsofphp/php-cs-fixer
Code your stuff as usual and before commit, run...
- cd /full/server/path/to/the/G2Project-repo
- phpcbf /full/server/path/to/the/G2Project-repo
- php-cs-fixer fix
This will take quite a lot of time due to the large number of files checked. Step 2 takes the bulk of this time and Step 3 will speed up on subsequent runs.
The style rules are already in the package and this will pick them up.
The pre-commit hook will only pass changed files so will be much less time. I just need to run a few tests first.
The file you have here: https://raw.githubusercontent.com/miceno/gallery2-ahpn/develop/.phpstorm.cs.xml seems to be reasonably close.
Main things I see from a quick look are:
- TAB_SIZE = 4
- CONTINUATION_INDENT_SIZE = 4
- SPACE_AFTER_TYPE_CAST = false
- KEEP_SIMPLE_METHODS_IN_ONE_LINE = false
- Keep indents on empty lines = false
- Braces placement = End of line
I don't actually use PHPStorm so this is an estimate.
So a manual run for now and later the hook will take care of things.
Thank you!!I will manage with these commands. There are tutorials on how to integrate those tools in PHPstorm.I was using a WordPress set of rules, I didn't try with PSR 2.The pre commit hook is a great idea.I think it will be enough to run the fixer on the files I plan to commit, or in any folder I add and not in all the code, since you have already formatted it.Regards.On Jan 19, 2019 09:40, dakanji notifications@github.com wrote:It is basically PSR 2 with tabs for indentation and spaces for alignment. Working on making this easier to adopt using composer but I need to test. You could temporarily do the following:
composer global require "squizlabs/php_codesniffer=*"composer global require friendsofphp/php-cs-fixer
Code your stuff as usual and before commit, run...
cd /full/server/path/to/the/G2Project-repophpcbf /full/server/path/to/the/G2Project-repophp-cs-fixer fix
This will take quite a lot of time due to the large number of files checked. Step 2 takes the bulk of this time and Step 3 will speed up on subsequent runs. The style rules are already in the package and this will pick them up. The pre-commit hook will only pass changed files so will be much less time. I just need to run a few tests first. The file you have here: https://raw.githubusercontent.com/miceno/gallery2-ahpn/develop/.phpstorm.cs.xml seems to be reasonably close. Main things I see from a quick look are: TAB_SIZE = 4 CONTINUATION_INDENT_SIZE = 4 SPACE_AFTER_TYPE_CAST = false KEEP_SIMPLE_METHODS_IN_ONE_LINE = false Keep indents on empty lines = false Braces placement = End of line I don't actually use PHPStorm so this is an estimate. So a manual run for now and later the hook will take care of things.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
I think it will be enough to run the fixer on the files I plan to commit, or in any folder I add and not in all the code
That should work...
- phpcbf /full/server/path/to/the/G2Project-repo/affected/folder
- php-cs-fixer fix /full/server/path/to/the/G2Project-repo/affected/folder
Unfortunately both tools are needed as neither gives a full result alone as of now.
Please pull the dev branch and see contributing.md for instructions on setting up the dev environment