Closed (fixed)
Project:
Rules
Version:
8.x-3.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Sep 2019 at 12:15 UTC
Updated:
13 Oct 2019 at 00:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tr commentedThe first three are false positives due to commented out code - the right way to fix those is to finish off the commented code.
The next two I'm OK with - I think the code is currently clearer without trying to adhere to that one arbitrary standard (and this was noticed and explained in the issue when those lines were added).
The last I don't know about - did that start to appear recently? That test only has @inheritdoc for all functions so unless the parent class has changed it should be fine. I am on my phone with limited cell phone reception for the next week so I can't really look into that.
Comment #3
tr commentedI can see that last one first appeared on 29 Aug and was not present on 28 Aug. Rules did not have any commits for 10 days before that and 5 days after that. So either the coding standards changed or there was a core change that affected Rules. Needs some research ...
Comment #4
jonathan1055 commentedFor the blank lines following an inline comment I totally agree that the code is clearer as-is. Our phpcs.xml.dist file currently has
which has been there for a while, so I think Fago also agreed that we are fine with blank lines after inline comments. However, there is now (maybe not originally) also a "Drupal" as opposed to "DrupalPractice" sniff
Drupal.Commenting.InlineComment.SpacingAfterwhich appears to do the same thing, and it is this one which is now reporting the fault. So I'm going to add that also to the excluded list. No point in having one and not the other.For the rules.drush.inc long lines, I've just split the strings in the places required. It will be easy when we come to implement this to revert back to the un-split strings.
Comment #5
jonathan1055 commentedWell, that was surprising! I expected the blank lines and the drush.inc long lines to be fixed, so was anticipating having just the 'Missing member variable doc comment' in tests/src/Unit/TestMessenger.php. But that fault has disappeared too, and there are zero code standard problems.
I checked the Jenkins dispatcher log and yes, when phpcs.xml.dist is modified the entire project is sniffed.
So it was not just the changed files that are tested, as per normal patches when phpcs.xml.dist is untouched.
I do get the TestMessenger.php error locally, using exactly the same Rules code and phpcs.xml.dist as in this patch. However, it does not show up in my Travis test. So there must be something odd causing these differences. As you say, the code looks fine and it has not been changed during the period when d.o. started reporting this fault. It will be interesting to see the phpcs result when this patch is committed. The error may be back again.
Comment #6
jonathan1055 commentedJust had a lighbulb moment! I think it is related to the PHP/Core/PHP_CodeSniffer versions being run. The Rules test on 8th Sep at Core 8.7 using PHP7.2 and PHP_CodeSniffer 3.4.1 did not report this fault. There were only 4 errors
https://www.drupal.org/pift-ci-job/1399928
However, the test on 13th Sept at core 8.8 with PHP7.3, and PHP_CodeSniffer 3.4.2, reports the six messages
https://www.drupal.org/pift-ci-job/1404054
D.O patch testing uses PHP 7.2 and PHP_CodeSniffer 3.4.1 currently so that is why the message did not show. This would also explain why I get 4 messages not 6 in my Travis test. I am using PHP7.1 locally with PHP_CodeSniffer 3.4.2 and I do get the message, so it would suggest that it is the newer version of PHP_CodeSniffer which has caused the difference.
Comment #7
jonathan1055 commentedTo see if my reasoning is correct I have requeued patch #4 using PHP7.3 and Core 8.8, so it should use PHP_CodeSniffer 3.4.2 and we'll get the one 'Missing member variable doc comment' for TestMessenger.php.
This is actually a fault we can fix, because line 12 is not the
@inheritdocfor the test, but it is the$messagesproperty, and it has no doc desciption. That check must have been introduced in the latest PHP_CodeSniffer.Comment #8
jonathan1055 commentedYes, the test of patch #4 at core 8.8/PHP7.3 has
in the log and produces the one error 'Missing member variable doc comment' in TestMessenger.php.
Here's an updated patch to correct this.
Comment #9
tr commentedThanks for looking into this @jonathan1055
I prefer not to mess with the commented out code. Instead, let's try to tell phpcs to ignore standards for that comment block. Here's a slightly modified patch which should do that ...
Comment #10
tr commentedI missed one. New patch.
Comment #11
jonathan1055 commentedI like that solution even better.
Marking as RTBC
Comment #13
tr commentedCommitted. Thanks.