Skip to content

Re-enable PHP Code Quality Checks in Github Actions #724

Closed
@ThomasAFink

Description

@ThomasAFink

Task Description

Currently, the code quality checks with phpcs and phpmd are deactivated in the GitHub Actions. These checks should be reactivated to ensure compliance with coding standards and to identify potential code issues.

The checks should be executed before the unit tests for each PHP module.

Background Information / Details for Implementation

PHP_CodeSniffer (phpcs):

  • Ensures that the code adheres to defined coding standards.
  • Currently executed with the PSR-2 standard but should be updated to PSR-12.
vendor/bin/phpcs --standard=psr12 src/{{}}

PHP Mess Detector (phpmd):

  • Performs static code analysis to detect potential issues such as unused variables, complex methods, and problematic code.
  • Uses the configuration file phpmd.rules.xml.
vendor/bin/phpmd src/ text phpmd.rules.xml
  • Both checks should be conducted before the unit tests to ensure the code is clean prior to running tests.

GitHub Actions Workflows Directory

Acceptance Criteria

  • The GitHub Actions pipeline executes phpcs and phpmd before the unit tests for each module.
  • The checks run for all PHP modules:
    • zmsadmin
    • zmscalldisplay
    • zmscitizenapi
    • zmsdldb
    • zmsentities
    • zmsmessaging
    • zmsslim
    • zmsstatistic
    • zmsticketprinter
  • The existing configuration (matrix strategy) is extended to integrate the new checks.
  • The workflow fails and stops the pipeline if code-check errors are found.
  • Current formatting issues must be resolved (fix errors before merging into next).
  • Documentation of the new checks and updates in the README.md should include instructions on how to execute them with ddev ssh.

Ask @coderabbitai on how to get started.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code complexity and formattingReduce code complexity or fix formattingphpPull requests that update Php code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions