Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-77458

Add phpcs testVersions to .phpcs.xml

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-77458-401
    • MDL-77458-master
    • Hide
      1. Install phpcs using the Moodle Ruleset

        composer global require moodlehq/moodle-cs
        

        https://moodledev.io/general/development/tools/phpcs#installation

      2. Go to your moodle instance's root folder.
      3. Run grunt ignorefiles

        nvm use
        npm ci
        npx grunt ignorefiles
        

        Note: The nvm use and npm ci commands are present just to make sure that things are up-to-date. They are not strictly necessary

      4. Run phpcs -vv to check the configuration:
        • Note: Make sure that phpcs is in your path. You can do this by running "export PATH=~/.composer/vendor/bin:$PATH".

          phpcs -vv | head
          

        1. Confirm that there was a line for "set config value testVersion"
        2. Confirm that the line has the correct supported versions for Moodle

      Testing the behaviour

      1. Copy the attached phpcstest.php and place it into your Moodle directory
      2. Run phpcs against it:

        phpcs phpcstest.php
        

      3. Confirm the expectations:
        Line Master 401 400 311 Notes
        28 YES YES YES YES 5.3 deprecation
        31 YES YES YES YES 5.6 deprecation
        36 NO NO NO NO 7.0 new feature
        41 YES YES YES YES 7.1 deprecation
        44 NO NO NO NO 7.1 new feature
        49 YES YES YES YES 7.2 deprecation
        54 YES YES YES YES 7.3 deprecation
        57 NO NO NO NO 7.3 new feature
        62 YES YES YES YES 7.4 deprecation
        67 NO NO YES YES 7.4 new feature
        71 YES YES YES YES 8.0 deprecation
        74 NO YES YES YES 8.0 new feature
        77 YES YES NO NO 8.1 deprecation
        81 YES YES YES YES 8.1 new feature
        86 YES NO NO NO 8.2 deprecation
        89 YES YES YES YES 8.2 new feature

      Supported version reference

      Version Master 401 400 311
      7.2 and earlier NO NO NO NO
      7.3 NO NO YES YES
      7.4 NO YES YES YES
      8.0 YES YES YES YES
      8.1 YES YES NO NO
      8.2 YES NO NO NO
      8.3+ YES NO NO NO
      Show
      Install phpcs using the Moodle Ruleset composer global require moodlehq/moodle-cs https://moodledev.io/general/development/tools/phpcs#installation Go to your moodle instance's root folder. Run grunt ignorefiles nvm use npm ci npx grunt ignorefiles Note: The nvm use and npm ci commands are present just to make sure that things are up-to-date. They are not strictly necessary Run phpcs -vv to check the configuration: Note: Make sure that phpcs is in your path. You can do this by running " export PATH=~/.composer/vendor/bin:$PATH ". phpcs -vv | head Confirm that there was a line for " set config value testVersion " Confirm that the line has the correct supported versions for Moodle Testing the behaviour Copy the attached phpcstest.php and place it into your Moodle directory Run phpcs against it: phpcs phpcstest.php Confirm the expectations: Line Master 401 400 311 Notes 28 YES YES YES YES 5.3 deprecation 31 YES YES YES YES 5.6 deprecation 36 NO NO NO NO 7.0 new feature 41 YES YES YES YES 7.1 deprecation 44 NO NO NO NO 7.1 new feature 49 YES YES YES YES 7.2 deprecation 54 YES YES YES YES 7.3 deprecation 57 NO NO NO NO 7.3 new feature 62 YES YES YES YES 7.4 deprecation 67 NO NO YES YES 7.4 new feature 71 YES YES YES YES 8.0 deprecation 74 NO YES YES YES 8.0 new feature 77 YES YES NO NO 8.1 deprecation 81 YES YES YES YES 8.1 new feature 86 YES NO NO NO 8.2 deprecation 89 YES YES YES YES 8.2 new feature Supported version reference Version Master 401 400 311 7.2 and earlier NO NO NO NO 7.3 NO NO YES YES 7.4 NO YES YES YES 8.0 YES YES YES YES 8.1 YES YES NO NO 8.2 YES NO NO NO 8.3+ YES NO NO NO

      As discussed in https://github.com/moodlehq/moodle-plugin-ci/pull/206#issuecomment-1450993674 we shoudl add the test versions to our .phpcs.xml.

      https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset

      We can still override this, but it would be best to have it in our default per-branch configuration.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Tim Hunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Jun Pataleta Jun Pataleta
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.