This is a follow up issue to the issue #2700661: Ensure core compliance to Drupal.Commenting.FunctionComment.ParamCommentIndentation (part 1). Simple fixes to the issue has been uploaded as a patch in the parent issue. This issue is to handle the review of less simpler fixes for the issue.

Comments

anoopjohn created an issue. See original summary.

anoopjohn’s picture

Attaching the patch with the less simpler fixes to the issue

anoopjohn’s picture

Status: Active » Needs review
anoopjohn’s picture

I see that there are two ways of preventing coder from not considering a failure in a sub-sniff as an error

One is to add the sniff and set the severity of the sub-sniff

  <rule ref="Drupal.Commenting.FunctionComment" />
  <rule ref="Drupal.Commenting.FunctionComment.Missing">
    <severity>3</severity>
  </rule>
  <rule ref="Drupal.Commenting.FunctionComment.WrongStyle">
    <severity>3</severity>
  </rule>
  <rule ref="Drupal.Commenting.FunctionComment.SpacingAfter">
    <severity>3</severity>
  </rule>

The second is to add the sniff and exclude sub sniffs

  <rule ref="Drupal.Commenting.FunctionComment">
    <exclude name="Drupal.Commenting.FunctionComment.DuplicateReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.EmptySees"/>
    <exclude name="Drupal.Commenting.FunctionComment.ExtraParamComment"/>
  </rule>

I like the second one as it seems to be self contained

For the Drupal.Commenting.FunctionComment rule, it seems to be enough to exclude only a subset of rules to prevent any errors

  <rule ref="Drupal.Commenting.FunctionComment">
    <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
    <exclude name="Drupal.Commenting.FunctionComment.WrongStyle"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNewLine"/>
    <exclude name="Drupal.Commenting.FunctionComment.IncorrectParamVarName"/>
    <exclude name="Drupal.Commenting.FunctionComment.SpacingAfter"/>
    <exclude name="Drupal.Commenting.FunctionComment.SpacingAfterParamType"/>
  </rule>

Should we exclude all rules in phpcs.xml or just exclude the ones that actually need fixes?

alexpott’s picture

Status: Needs review » Closed (duplicate)

Nice find on the phpcs.xml.dist exclude thing - looks great. Let's merge this with #2707641: Ensure core compliance to Drupal.Commenting.FunctionComment.ParamCommentIndentation (part 2)