Skip to content

Review PHP automated formatting (php-cs-fixer) #10049

Open

Description

Describe the issue
Noticed that some of the PHP file - for example lib/pkp/classes/core/PKPPageRouter.php are not formatted yet with php-cs-fixer. I am using php-cs-fixer in vscode to format files on file save - and as result when I introduce new changes its combination of code specific changes and formatting changes which makes PRs difficult to review.

Our current setup (intended)

  • we rely on friendsofphp/php-cs-fixer to apply formatting rules
  • rules configuration is lib/pkp/.php_cs_rules
  • on app level (ojs/omp/ops) we rely on JS tools - lint-staged and husky to execute the php formatting. The formatting is applied only on files that has been changed (staged).
  • on pkp-lib level we use captainhook, because js toolkit is not present there to achieve the same thing - format php files that has been changed on precommit hook

Proposed steps for improvements

  • apply the formatting on all php files to have up to date formatting
  • check whether both (on app level and pkp-lib level) mechanisms for automatic formatting on precommit work
  • probably good opportunity to update version of php-cs-fixer before applying the format changes

What application are you using?
OJS, OMP or OPS version main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Housekeeping:1:TodoAny dependency management or refactor that would be nice to have some day.Try MeThis issue might be good for a new contributor. Can you help us?

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions