Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I recently fixed a lot of Drupal.Commenting.FunctionComment.SeePunctuation errors in core. The issue was not automatically fixable by phpcbf. I believe this should be fixable. If you can please give me some directions I can go ahead and try to get this done.
Comment | File | Size | Author |
---|---|---|---|
#5 | coder-see-punctuation-autofix-2716681-5.patch | 1.77 KB | anoopjohn |
Comments
Comment #2
klausiIn the sniff we are calling $phpcsFile->addError(), but we should call $phpcsFile->addFixableError(). Then if that returns true we are in fixer mode and need to modify the contents. Check out other calls to addFixableError() and what happens after them to learn how to write the fixer code.
Comment #3
anoopjohn CreditAttribution: anoopjohn at Zyxware Technologies commentedThanks for the reply. I was thinking there would be some documentation I could take a look at. I will look at code and see if I can come up with a fix for this error. Hopefully this one would be an easy one to learn and fix.
Comment #4
anoopjohn CreditAttribution: anoopjohn at Zyxware Technologies commentedI have attempted to fix this. Please find attached the patch.
Comment #5
anoopjohn CreditAttribution: anoopjohn at Zyxware Technologies commentedRan phpunit :) and found a need to update bad.php.fixed. Updated patch with the change in bad.php.fixed as well.
BTW do we have to comment the fix details in bad.php? Add the description in the same functions description saying that the test includes test for punctuations in @see?
Or change my_function(). to punctuation_not_allowed_in_see_reference().
Comment #7
klausiThanks, simplified the patch a bit and committed it.
Comment #8
anoopjohn CreditAttribution: anoopjohn at Zyxware Technologies commentedGreat. Thanks. That is a good start. Let me see if there is another error I can fix :-)