moodlehq / moodle-cs

Moodle Coding Style

Home Page:https://github.com/moodlehq/moodle-cs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid docblock tag "@group".

gjb2048 opened this issue · comments

Using version 3.4.5 - https://github.com/moodlehq/moodle-cs/releases/tag/v3.4.5 - manually downloaded and installed in appropriate vendor folder, I get:

Screenshot 2024-04-01 135230

with the code:

Screenshot 2024-04-01 135308

and yet https://moodledev.io/general/development/tools/phpunit#using-the-group-annotation states that the tag is valid and how it can be used on the test class - not the test method as stated on https://docs.phpunit.de/en/9.6/annotations.html#group (using PHPUnit 9.6.18 in M4.4 dev - 4.4dev+ (Build: 20240326)).

I suspect this is a case of Windows pathnames not being normalised. Our comparisons for valid paths use a regex of '#.*/tests/.*_test.php#'.

Writing a test now to confirm this.

Thanks Gareth,

This appears to be a Windows path normalisation issue. I've:

  • added tests to run on Windows
  • added a specific test for @group
  • added path normalisation which addresses these and other issues

Eloy is on leave for the next few days so I'm afraid it's unlikely that this will get looked at before then. If you're running locally you can clone this repo, merge the branch in #146 locally and run it from there by pointing a repository to it. This is my ~/.composer/composer.json for reference:

{
    "require": {
        "moodlehq/moodle-cs": "dev-main"
    },
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    },
    "repositories": [
      {
        "type": "path",
        "url": "/Users/nicols/git/moodlehq/moodle-cs"
      }
    ],
    "minimum-stability": "dev"
}

@andrewnicols Thank you :), I'll have a go as soon as I can (today I hope) as indeed running locally.

@andrewnicols Working, thank you :). I couldn't work out the composer.json replacement, so instead downloaded the code (zip) from https://github.com/andrewnicols/moodle-cs/tree/phpunitTags and replaced manually.

Good stuff @gjb2048, I'll try and remember to ping you when we release so you an roll that back.

@gjb2048, you should be able to update from composer to fix this issue.