Closed gthomas2 closed 2 years ago
Aha,
surely the problem is that the moodle.PHPUnit.TestCaseNames.Missing
is assigned to line 0 ... and that's before the // phpcs:disable moodle.PHPUnit.TestCaseNames.Missing
can do its magic.
Will try to imagine if there is a better way to assign to it another line, although it's not guaranteed that such a line will exist always...
Does it work for you if you addd it to the very first line, aka:
<?php // phpcs:disable moodle.PHPUnit.TestCaseNames.Missing
It seems to be doing the trick here and I'm not sure that finding alternative lines to report it is going to work always.
Thanks for the fast response and suggestion. If I add it to line 0 I'll get this instead though : Line 3 of the opening comment must start "// Moodle is free software: you can redistribute it and/or modify
Aha,
I did not have the BoilerplateComment sniff in the file I tested the phphcs:disable
above, well spotted!
Ok, I'm going to try if this can be solved by any of:
Will comment here once I get any of them working... ciao :-)
// phpcs:xxxx
comments in first line.TestCaseNames.Missing
error in class lines, instead of line #0.Unless I'm wrong, that should fix this problem completely (and the phpcs comment can be put in any line).
Ciao :-)
Thanks so much for the super fast fix of this issue. Impressive!
If I add the following:
phpcs:disable moodle.PHPUnit.TestCaseNames.Missing
I still get the error showing up:
moodle.PHPUnit.TestCaseNames.Missing
Use case for not wanting this sniff:
I have an abstract class with all my tests in it. The abstract class will test according to the value of a constant set on the class. I have two sub classes of the abstract class which have different constants to make the tests behave differently. There is no need for me to have test methods in the sub classes.