kitodo / kitodo-presentation

Kitodo.Presentation is a feature-rich framework for building a METS- or IIIF-based digital library. It is part of the Kitodo Digital Library Suite.
https://kitodo.org
GNU General Public License v3.0
38 stars 45 forks source link

Use PHP Standard Recommendation (PSR) coding style #80

Closed stweil closed 6 years ago

stweil commented 8 years ago

TYPO3 switched to PSR-2 (see issue 70515). PSR-2 is a standard (Coding Style Guide) recommended for PHP code.

I suggest using this standard for Goobi.Presentation, too. A related issue is #65.

One major change is replacing tab characters by spaces. Obviously this is a general trend for free software projects.

See also the German article in Wikipedia.

stweil commented 8 years ago

Other coding standards for PHP:

Free tools which report and also fix some coding style issues automatically:

stweil commented 8 years ago

Comments? Should we discuss this issue at the Goobi e. V. meeting, or can we reach a consensus and present it there?

sebastian-meyer commented 8 years ago

Since the TYPO3 project uses PSR-2, we should adapt the coding styles, too. But this needs approval from the general assembly.

I'll prepare a vote for the general assembly.

stweil commented 8 years ago

That sounds like we'll reach a consensus on coding style for goobi-presentation, very good.

I'd try to keep discussions about coding style out of the general assembly, maybe not now (because the discussion was already started last time and because of the header issue), but for the future.

It's necessary to inform of course and also to vote if a consensus cannot be reached otherwise. Technical issues like coding style are something which is important for developers, but not very interesting for most other people. We already made technical decisions (like using static code analyzers or introducing continuous integration) without asking the general assembly, and I think that is fine as long as such discussions are open for all interested parties.

Maybe it is possible to get a consensus for a more pragmatic approach like that in the general assembly.

sebastian-meyer commented 8 years ago

While using static code analyzers and continuous integration is only a recommendation, any changes to the coding style require changing the official Goobi Coding Guidelines. Any changes to this document, however, need approval from the general assembly according to the Goobi e.V.'s statutes.

Therefore we should prepare a revised coding styleguide, introduce the changes to the general assembly and let it approve them.

stweil commented 8 years ago

But we are free to suggest that any details of coding style should not be part of the Goobi Coding Guidelines, aren't we? Those guidelines could simply state that each Goobi project must have a coding style which has to be discussed, documented and updated as part of the project's development activities. IMHO it is not necessary that the guidelines say something about PSR-2, tabs, UTF-8, linefeeds, etc. They should say that we try to be international (therefore English and UTF-8) and that we want to use best practices from other free software projects (therefore PSR-2, OO designs), etc.

Maybe it is possible to get a consensus for a more pragmatic approach like that in the general assembly.

That means simplify the Goobi Coding Guidelines, shift responsibility from that guidelines to the developer community, and get a vote for that change.

sebastian-meyer commented 6 years ago

The new Kitodo Coding Guidelines can be found here: http://www.kitodo.org/fileadmin/groups/kitodo/Dokumente/Kitodo-EntwicklerLeitfaden_2017-06.pdf