Closed stronk7 closed 1 year ago
Ok, adding a phpcs.xml
file with contents:
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="moodle" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<rule ref="MoodleCS/moodle"/>
</ruleset>
seems to be enough. It:
phpcs.xml
files upwards.Curiously... this shouldn't be needed because, in theory, phpcs.xml
files are only searched if not standard has been specified and our runs are, 100% sure, specifying the standard always. Anyway, I won't look more about this. Historically the CLI/API use of PHP_CodeSniffer has been "complex", and sometimes they only look for CLI options that we aren't using. So... who knows.
The important point is that by providing a correct phpcs.xml
file like the above... the "moodle" alias is not tried anymore and things come back to work under Windows, that doesn't understand the "moodle" alias.
Going to perform some more test and will create PR.
Ciao :-)
Ok, I've tried both Web and the run.php
utility, Unix and Windows... and everything seems to be working ok with the phpcs.xml
file above. Heading to create a PR...
Since some months ago, core includes a
.phpcs.xml
file, really useful that instructs to any PHP_CodeSniffer about which standard must be used by default.And the standard is "moodle" how now.
Problem is that PHP_CodeSniffer first looks for local (pwd) directories with that name ("moodle") and, in the case of codechecker, that's currently a soft alias, pointing to the new moodle-cs standard, and kept on purpose to allow other tools to continue working.
While codechecker's bundled PHP_CodeSniffer doesn't need that file at all (because the standards are perfectly configured via .conf file), its default behaviour is to look to those
.phpcs.xml
files. Then it reads "moodle" from there and resolves it to the soft alias. And soft aliases don't work on Windows, causing an error.We need to ensure that codechecker's bundled PHP_CodeSniffer stops looking to core
.phpcs.xml
, surely by introducing its own.phpcs.xml
file (that will cause it to stop looking upwards). At least that's the theory.Let's see. Ciao :-)