moodlehq / moodle-cs

Moodle Coding Style

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing with error: Referenced sniff "./.phpcs.xml.dist" does not exist

marinaglancy opened this issue · comments

I followed the installation instructions from the README.md that tells me to install it globally via composer:

composer global require moodlehq/moodle-cs

First problem is that the README.md does not really tell me how to run it (I think it should, heh). But I figured it eventually. And here I get an error:

$ /home/marina/.config/composer/vendor/bin/phpcs admin/tool/tenant/
ERROR: Referenced sniff "./.phpcs.xml.dist" does not exist

Run "phpcs --help" for usage information

The file phpcs.xml.dist is present it moodle but it is lookig for .phpcs.xml.dist which does not. I "solved" it by copying it:

cp phpcs.xml.dist .phpcs.xml.dist

Now moodle-cs works for me but I'm sure it should be easier than that...

I don't think this is right.

The phpcs.xml.dist is in Moodle core. It was introduced in MDL-77458.
The npx grunt ignorefiles task will generate a new phpcs.xml file which loads phpcs.xml.dist
And then the file documented here .php.xml will load the phpcs.xml generated by ignorefiels (which loads phpcs.xml.dist)

I'm not clear on what .phpcs.xml.dist file you have. What version of Moodle are you running with?

I'm sorry, there was some mistake in my .phpcs.xml , I am not sure how it was created but it was wrong and it was referencing the .phpcs.xml.dist . I'll close this issue. Sorry again for the noise