Skip to content

Releases: moodlehq/moodle-cs

v3.4.0

07 Mar 09:58
f71d22b
Compare
Choose a tag to compare

Added

  • Add new moodle.PHPUnit.TestCasesAbstract sniff to check that testcase classes are declared abstract.
  • Add new moodle.PHPUnit.TestClassesFinal sniff to check that test classes are declared final.
  • Add new moodle.Commenting.Package sniff to replace those present in moodle-local_moodlecheck.
  • Add new moodle.Commenting.Category sniffs to replace those present in moodle-local_moodlecheck.
  • New phpcs.xml.dist to enforce the coding style to follow by ´moodle-cs´ itself. Basically, PSR12 ruled. CI verified from now on.

Changed

  • Modified own CI scripts, updating various GH actions.
  • Reallocated own tests structure, to better organise them and fixture files.
  • Update composer dependencies to current versions, notably PHP_CodeSniffer (3.9.0) and PHPCompatibility (e5cd2e24).
  • As part of the move to be PSR12 compliant, all the methods used for testing have been converted, without deprecation, to camel case (setStandard(), setSniff(), ...).
  • ACTION REQUIRED: Any clone/fork using moodle-cs and having own tests will need to adapt them to the new method names.

Fixed

  • The moodle.Files.MoodleInternal sniff no longer treats Attributes as side-effects.

Full changelog

v3.3.15

15 Feb 18:24
3a95fd8
Compare
Choose a tag to compare

Added

  • Function declaration lines are verified to have correct whitespace separation (1 space or 0 spaces) between all their parts.

Changed

  • Modified own CI scripts, bumping them from NodeJS 16 to NodeJS 20 actions.

Fixed

  • PHP enum uses are not considered side-effects by some sniffs.
  • PHPDoc blocks are allowed before PHP attributes, that are immediately followed by the PHP structure.
  • The PHPUnit dataProvider sniff now reports the problematic lines properly.
  • The valid variable names sniff now detects properly escaped (\$) contents within double quoted strings and they aren't considered - for validation - anymore.
  • Avoided PHP error when checking empty PHP files.

Full changelog

v3.3.14

26 Jan 15:50
7e12e69
Compare
Choose a tag to compare

Changed

  • Modified internal CI scripts towards better Codecov future support.

Fixed

  • Solved a problem with some moodle.PHPUnit Sniffs running an endless loop when processing abstract test methods.

Full changelog

v3.3.13

19 Jan 16:58
f4c5229
Compare
Choose a tag to compare

Changed

  • Applied various internal, coding and CI improvements:
    • Modified own CI tests to behave better.
    • Locked nikic/php-parser to v4 to avoid jumping to v5 yet (PHP compatibility).
  • Updated composer dependencies to current versions, notably PHP_CodeSniffer (3.8.1).

Added

  • New moodle.Commenting.TodoComment Sniff will be in charge to control that all the todo comments in core (both // TODO and @todo ones) always come with a link to the MDL project in the Tracker.

    Its behaviour can be controlled both by the commentRequiredRegex property in ruleset files or by the moodleTodoCommentRegex configuration option in phpcs.xml files and CLI invocations. Setting them to empty string disables the Sniff completely.

Full changelog

v3.3.12

19 Dec 15:37
9e3dcb0
Compare
Choose a tag to compare

Changed

  • Moved PHP_CodeSniffer from squizlabs (being abandoned) to PHPCSStandars (new repository). Everybody is welcome to contribute or help sponsoring the project!
  • Update composer dependencies to current versions, notably PHP_CodeSniffer (3.8.0) and PHPCompatibility (306cd263).
  • Applied various internal, coding and CI improvements:
    • Ruleset fixes.
    • PHP 8.3 compliance achieved.
    • PHP 8.3 GitHub workflows support.

Full changelog

v3.3.11

29 Nov 16:35
a415a54
Compare
Choose a tag to compare

Changed

  • Amended the installation instructions to be able to use some dev dependencies.
  • Moved all links to "master" branches to their new "main" counterparts.

Fixed

  • Solved a problem with the CommaAfterLast Sniff that was causing some valid multi-line arrays to be identified as invalid, missing commas.

Full changelog

v3.3.10

20 Oct 07:25
13192ea
Compare
Choose a tag to compare

Added

  • Detected various duplicate array keys cases (code smell).
  • Enforced, for Moodle 4.4dev and up, that all the test methods have a return type specified (normally : void).

Full changelog

v3.3.9

26 Sep 14:54
5503396
Compare
Choose a tag to compare

Added

  • Defined (via .gitattributes) which files must not be part of distribution (generated .zip & .gz in GitHub, --prefer-dist in Composer, ...) packages. This includes docs, ci files, tests... Note that it's still possible to download the complete packages (using git clone, --prefer-source with Composer, ...).

Fixed

  • Removed the PSR1.Classes.ClassDeclaration.MissingNamespace sniff from the moodle-extra standard because it was reporting some (for Moodle) false positives.

Full changelog

v3.3.8

22 Sep 17:29
ff540d2
Compare
Choose a tag to compare

Added

  • Detect PHPUnit data provider (@dataProvider) declarations using () after the function name.

Fixed

  • Fixed a problem with some non test files (coverage.php, ...) being managed as such.

Full changelog

v3.3.6

15 Sep 11:21
9292e56
Compare
Choose a tag to compare

Added

  • A new moodle-extra coding standard which moves towards a more PSR-12 compliant coding style.
  • Enforce the use of the short array syntax ([]), warning about the long alternative (array()): Generic.Arrays.DisallowLongArraySyntax. This will be raised from warning to error in 1 year.

Full changelog