moodlehq / moodle-cs

Moodle Coding Style
https://github.com/moodlehq/moodle-cs
GNU General Public License v3.0
18 stars 15 forks source link

Invalid docblock tag "@group". #145

Closed gjb2048 closed 5 months ago

gjb2048 commented 5 months ago

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)).

andrewnicols commented 5 months ago

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.

andrewnicols commented 5 months ago

Thanks Gareth,

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

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"
}
gjb2048 commented 5 months ago

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

gjb2048 commented 5 months ago

@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.

andrewnicols commented 5 months ago

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

andrewnicols commented 5 months ago

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

gjb2048 commented 5 months ago

@andrewnicols Thank you :)