Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-2003

Run syntax check (lint) on all PHP files before the release

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: Integration
    • Labels:
      None

      Description

      This is a suggestion to establish a new rule: "Every file with .php extension must have correct PHP syntax (in other words, it must pass php -l). If there is a reason (eg for unit tests) to have a PHP file with broken syntax, it must have different extension."

      Such a rule would be enforced by a new pre-release step in the integration chain. Something like the following shell in Jenkins:

      #!/bin/bash -e
       
      find -L ${pathtomoodle} -name 'index.php' -print0 | xargs -0 -n 1 -P 4 php -l

      It ends with return status 0 (success) if no syntax error is detected. It stops with the return status >0 otherwise and Jenkins marks such a build as a failure.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              poltawski Dan Poltawski
              Reporter:
              mudrd8mz David Mudrák (@mudrd8mz)
              Participants:
              Component watchers:
              Eloy Lafuente (stronk7)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: