Feature #13317

Implement PHP code standard and formatter

Added by David Juhasz 3 months ago. Updated 3 months ago.

Status:NewStart date:05/14/2020
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Sponsored:No Tested version:

Description

Problem

AtoM has a custom coding standard that is not compatible with predominant PHP coding standards, e.g. PSR-1, PSR-12, Symfony's CS. Because the AtoM CS is idiosyncratic it requires extensive configuration to automate code formatting with a PHP code formatter. Maintaining unique coding standards for AtoM also requires maintaining independent documentation of the standard, and PHP developers that want to contribute code to the project must learn a new and niche coding standard.

Proposed Solution
  1. Select an existing PHP coding standard and code formatting tool that can implement the chosen standard with minimal configuration
  2. Configure the chosen code formatter to implement the chosen coding standard, and run the tool to reformat the existing AtoM code (in a dev branch)
  3. Do QA testing of the re-formatted AtoM code, to make sure the formatter hasn't broken any functionality
  4. Merge the re-formatted dev branch to the current main (qa) branch
  5. Set up a continuous integration script to validate new code against the coding standard before the code can be merged to the main "stable" and "qa" branches of AtoM
  6. Document usage of the code formatter and configuration to enable developers to use the formatter to automate formatting of code contributed to AtoM
Suggested coding standards and formatters
  • PHP CS Fixer (started by SensioLabs, developers of Symfony) and PHP CodeSniffer look to be the two most popular FOSS CS validators/formatters
  • Symfony has their own Coding Standard and recommends PHP-CS-Fixer for validation and auto-formatting

History

#1 Updated by David Juhasz 3 months ago

  • Subject changed from Implement existing PHP code standard and formatter to Implement PHP code standard and formatter
  • Description updated (diff)

Also available in: Atom PDF