rugk/threema-msgapi-sdk-php

Coding style

rugk opened this issue · 5 comments

rugk commented

As part of the contribution guide we have to set some guidelines for contributing.
However currently there are already some minor style errors where several code analysers complain about (like the usage of tabs or that many brackets are not on a single line), so possibly we want to fix this before, so that we can later add this to the guidelines.

I would be very keen to run PHP-CS-fixer and add a suitable configuration file to the repo. However this would of course change much things, so I do want to discuss this before.

So @medienverbinder what do you think about it?

rugk commented

To prevent such clean-ups like in threema-ch/threema-msgapi-sdk-php@44073c2 I would recommend to add a Contributing.md where you can define everything which should or shouldn't be done when contributing to this project.

More information: https://help.github.com/articles/setting-guidelines-for-repository-contributors/

imported from threema-ch/threema-msgapi-sdk-php

rugk commented

+1

by @threema-ch
imported from threema-ch/threema-msgapi-sdk-php

rugk commented

Nice you like it - you just need to add it... 😃

The first thing e.g. would be 'use tabs instead of spaces' (although I don't like that, because it's basically the opposite of which is recommend by the PSR-2 standard).

imported from threema-ch/threema-msgapi-sdk-php

rugk commented

Additionally you may also add a configuration file for a tidy/beautifier/fixer script, which cleans the code automatically and makes sure the right code styling is used.

I don't know what tools you use (which seems to refuse to indent this line), but I can recommend the php-cs-fixer. It has predefined PSR-n rules, but you can also customize it by yourself (with a PHP file).

imported from threema-ch/threema-msgapi-sdk-php

rugk commented

So I added at least an .editorconfig file.