Adopt PSR-2 for our PHP code format

Bug #1576074 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Unassigned

Bug Description

Currently Mahara has its own idiosyncratic code formatting guidelines: https://wiki.mahara.org/wiki/Developer_Area/Coding_guidelines

It would make things easier for new devs, and improve tool support, if we switched to the industry standard PSR-2: http://www.php-fig.org/psr/psr-2/

It would also be good to decide on a Javascript coding standard.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Discussed at developer meeting 52: https://wiki.mahara.org/wiki/Developer_Area/Developer_Meetings/52

Developer consensus was to do it. We should do an initial big autoformat commit, and add an autoformatter to the Makefile. We should also check to see whether this will have a big impact on backporting.

Changed in mahara:
milestone: none → 16.10.0
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Jono M (jonom) wrote :

I'm definitely in favour of having a JS coding standard as well - preferably an industry standard rather than trying to duplicate the PHP guidelines.

http://jscs.info/overview has a list of common presets (and the tool itself might be useful for checking and autoformatting). As far as I know, AirBNB and Google are the most commonly used presets.

It might also be worth having a consistent way of creating DOM elements - either a consistent way of doing it in jQuery or a consistently used template engine. For example, Bootstrap has a reasonably nice pure-jQuery style - see https://github.com/twbs/bootstrap/blob/cf3f8e0d580888ec9459270ed67dc86c13f5b41a/js/tooltip.js#L37

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Changed in mahara:
milestone: 17.04.0 → 17.10.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 18.04.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.