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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anoopjohn created an issue. See original summary.

klausi’s picture

In 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.

anoopjohn’s picture

Thanks 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.

anoopjohn’s picture

Status: Active » Needs review
FileSize
1.27 KB

I have attempted to fix this. Please find attached the patch.

anoopjohn’s picture

FileSize
1.77 KB

Ran 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().

  • klausi committed 35ead48 on 8.x-2.x authored by anoopjohn
    Issue #2716681 by anoopjohn, klausi: Added fixer for superfluous @see...
klausi’s picture

Status: Needs review » Fixed

Thanks, simplified the patch a bit and committed it.

anoopjohn’s picture

Great. Thanks. That is a good start. Let me see if there is another error I can fix :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.