Releases: moodlehq/moodle-cs
v3.4.6
v3.4.5
v3.4.4
v3.4.3
Added
- Add new
moodle.Commenting.DocblockDescription
sniff to check that all the artifacts (classes, interfaces, traits, ...) and functions PHPDoc blocks have some description.
Changed
- The
moodle.Commenting.MissingDocBlock
sniff now also checks that constants are documented.
Fixed
- Solved a problem with file-level PHPDoc blocks not controlling the required blank lines after it.
- Fixed the PHPDoc block detection when multi-line PHP 8 attributes are used in the middle.
v3.4.2
Added
-
Add new
moodle.Files.LangFilesOrdering
sniff to check that lang files are sorted by key. -
Add new
moodle.Commenting.MissingDocBlock
sniff to check that all the artifacts (classes, interfaces, traits, ...) and functions are documented. -
Add new
moodle.Commenting.VariableComment
sniff to check that the@var
tag and its types are used correctly. -
Add new
moodle.Commenting.ValidTag
sniff to check that only allowed tags are used. -
Add new
moodle.Commenting.FileExpectedTags
sniff to check that files or classes have the correct PHPDoc block with both@copyright
and@license
information.The expected contents of the
@license
tag can be controlled both by thepreferredLicenseRegex
property in ruleset files or by themoodleLicenseRegex
configuration option inphpcs.xml
files and CLI invocations. Setting them to empty string disables the Sniff completely. By default, the "https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later" content is checked.
Note that all the moodle.Commenting
sniffs above are part of the migration from moodle-local_moodlecheck
to moodle-cs
. You can find more information about the deprecation of the former and links to track the progress in the announcement in General developer forum.
Changed
- Various reorganisations of tests, fixtures and utils affecting a number of sniffs.
v3.4.1
Fixed
- Solved a problem with the
moodle.Commenting.Package
sniff when running against arbitrary (not Moodle based) directories.
Full changelog
v3.4.0
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) andPHPCompatibility
(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
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
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
Changed
- Applied various internal, coding and CI improvements:
- Modified own CI tests to behave better.
- Locked
nikic/php-parser
tov4
to avoid jumping tov5
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 themoodleTodoCommentRegex
configuration option inphpcs.xml
files and CLI invocations. Setting them to empty string disables the Sniff completely.