moodlehq / moodle-local_codechecker

A Moodle local plugin providing a simple web UI to run the MoodleCS coding style checks with PHP_CodeSniffer.
63 stars 72 forks source link

CodeChecker does not detect the wrong space in $array [] = $newelement; #189

Closed timhunt closed 2 years ago

timhunt commented 2 years ago

In Moodle coding style,

$array [] = $newelement;

Is wrong.

It should be

$array[] = $newelement;

But, e.g. in https://tracker.moodle.org/browse/MDL-73808, we fail to detect that.

stronk7 commented 2 years ago

Can you try adding the following rule to moodle/ruleset.xml ? It seems to achieve what is being requested here (any spacing before/after array brackets.

<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>

I still have to add it with some tests in a PR, but that's the way, I think.

Ciao :-)

timhunt commented 2 years ago

Yes, that looks like the answer. Well found.