Skip to content

Commit

Permalink
Update readme_moodle and libraries
Browse files Browse the repository at this point in the history
Describe the new steps needed to update the components (basically
to updating moodle-cs), and update the thirdpartylibs.xml entries
to point to the new location in the vendor directory (that also
makes them to be ignored by codechecker itself).

Special note about the phpcompatibility dev version that we
are using and we'll be able to remove it once we switch to
stable releases.

Update phpunit configuration to avoid any coverage within the vendor dir.
  • Loading branch information
stronk7 committed Sep 24, 2023
1 parent 02dc216 commit 5db0329
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 112 deletions.
142 changes: 41 additions & 101 deletions readme_moodle.txt
Original file line number Diff line number Diff line change
@@ -1,101 +1,41 @@
Instructions to upgrade the moodle-cs bundled version:

- Drop a checkout of https://github.com/moodlehq/moodle-cs.git
within the "MoodleCS" directory of the plugin. Always removing
all the previous contents before copying.
- Also, remove not needed stuff, like:
- All dot (.*) files and directories (git, travis...).
- Any composer.* and vendor files.
- All .xml and .dist files.
- The moodle/Tests directory
- Update the details in thirdpartylibs.xml
- Update the details in this readme

Current checkout:

3.3.8 (ff540d2)

Local modifications (only allowed if there is a PR upstream backing it):

- None, right now.

===== ===== ===== ===== ===== ===== =====

Instructions to upgrade the phpcs bundled version:

- Drop a checkout of https://github.com/squizlabs/PHP_CodeSniffer.git
within the "phpcs" directory of the plugin. Always removing
all the previous contents before copying, but the CodeSniffer.conf
file that is needed to autodetect the PHPCompatibility standard.
- Also, remove not needed stuff, like:
- All dot (.*) files and directories (git, travis...).
- Any composer.* and vendor files.
- All .ini, .xsd, .neon and .dist files.
- The scripts, tests and vendor directories.
- Update the details in thirdpartylibs.xml
- Update the details in this readme

Current checkout:

3.7.2 (ed8e00df0)

Local modifications (only allowed if there is a PR upstream backing it):

- None, right now.

===== ===== ===== ===== ===== ===== =====

Instructions to upgrade the PHPCompatibility bundled version:

- Drop a checkout of the PHPCompatibility dir of https://github.com/PHPCompatibility/PHPCompatibility
within the "PHPCompatibility" directory of the local_codechecker plugin. Always
removing all the previous contents.
- Don't delete anything. 100% complete drop.
- Update the details in thirdpartylibs.xml
- Update the details in this readme

Current checkout:

10.0dev (0a17f9ed)

Local modifications (only allowed if there is a PR upstream backing it):

- Added PHPCSAliases.php to base dir to provide phpcs 2/3 compatibility. Needed
because still there are a number of old class names within the standard. This
doesn't have any upstream PR, because the file is there, just we had not needed
it before the jump to phpcs 3.

===== ===== ===== ===== ===== ===== =====

Instructions to upgrade the PHPCSExtra bundled version:
- Drop a checkout of https://github.com/PHPCSStandards/PHPCSExtra
within the "PHPCSExtra" directory of the local_codechecker plugin. Always
removing all the previous content.
- Don't delete anything. 100% complete drop.
- Update the details in thirdpartylibs.xml
- Update the details in this readme

Current checkout:

1.1.2 (746c319)

===== ===== ===== ===== ===== ===== =====

Instructions to upgrade the PHPCSUtils bundled version:

- Drop a checkout of the PHPCSUtils dir of https://github.com/PHPCSStandards/PHPCSUtils
within the "PHPCSUtils" directory of the local_codechecker plugin. Always
removing all the previous contents.
- Don't delete anything. 100% complete drop.
- Update the details in thirdpartylibs.xml
- Update the details in this readme

Current checkout:

1.0.8 (69465ca)

Local modifications (only allowed if there is a PR upstream backing it):

- None, right now.

===== ===== ===== ===== ===== ===== =====
Since version 5.0 of this plugin we have stopped
to manually copy all the tools needed manually
and, instead, we are installing them via `composer`.

Also, note that, with version 5.0 we have raised
PHP requirements to PHP 7.4 (it was 7.0 previously).
That implies that the min. Moodle supported version
is Moodle 3.8.3 (really old).

The tools needed for this to run are (you can also
see the 'composer.json` file for details):

- moodlehq/moodle-cs, that installs:
- squizlabs/php_codesniffer
- phpcompatibility/php-compatibility
- phpcsstandards/phpcsextra
- phpcsstandards/phpcsutils
- phpcompatibility/php-compatibility (dev version)

Special mention to the last package (phpcompatibility)
because, as far as we are using a `dev` version and not
a released one, we have to require it explicitly.

Once we switch to released versions, that explicit requirement
can be removed, because the `moodle-cs` tool already
includes it too.

To update any component:

1. Remove the .lock file, the vendor directory.
2. Run `composer clearcache` (to clear composer caches).
3. Switch to the lowest PHP version supported by the Moodle version required.
4. Run `composer install` (to install everything).a
5. Update `thirdpartylibs.xml` to annotate the new versions of the tools.
6. Commit changes with details about the tools updated.
7. Test, test, test.
8. Optionally, release.

At some point we may want to make the process above automated, so every time
that a new moodle-cs package is released, everything above (1-8) happens automatically.
See (last point of) https://github.com/moodlehq/moodle-local_codechecker/issues/114
5 changes: 1 addition & 4 deletions tests/coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@

/** @var array The list of folders relative to the plugin root to exclude from coverage generation. */
protected $excludelistfolders = [
'MoodleCS',
'moodle',
'PHPCompatibility',
'phpcs',
'vendor',
];

/** @var array The list of files relative to the plugin root to exclude from coverage generation. */
Expand Down
19 changes: 12 additions & 7 deletions thirdpartylibs.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
<?xml version="1.0"?>
<libraries>
<library>
<location>phpcs</location>
<location>vendor/squizlabs/php_codesniffer</location>
<name>PHP_CodeSniffer</name>
<version>3.7.2 (ed8e00df0)</version>
<license>BSD</license>
<licenseversion>3-Clause</licenseversion>
</library>
<library>
<location>PHPCompatibility</location>
<location>vendor/phpcompatibility/php-compatibility</location>
<name>PHP Compatibility Coding Standard</name>
<version>10.0dev (0a17f9ed)</version>
<license>LGPL</license>
<licenseversion>3</licenseversion>
</library>
<library>
<location>PHPCSExtra</location>
<location>vendor/phpcsstandards/phpcsextra</location>
<name>A collection of code standards for use with PHP_CodeSniffer</name>
<version>1.1.2 (746c319)</version>
<license>GPL</license>
<license>LGPL</license>
<licenseversion>3</licenseversion>
</library>
<library>
<location>PHPCSUtils</location>
<location>vendor/phpcsstandards/phpcsutils</location>
<name>A suite of utility functions for use with PHP_CodeSniffer</name>
<version>1.0.8 (69465ca)</version>
<license>GPL</license>
<license>LGPL</license>
<licenseversion>3</licenseversion>
</library>
<library>
<location>MoodleCS</location>
<location>vendor/moodlehq/moodle-cs</location>
<name>Moodle Coding Style</name>
<version>v3.3.8 (ff540d2)</version>
<license>GPL</license>
<licenseversion>3</licenseversion>
</library>
<library>
<location>vendor</location>
<name>Composer auto loading and plugins</name>
<license>MIT</license>
</library>
</libraries>

0 comments on commit 5db0329

Please sign in to comment.