Unfortunately, we have a major Drupal 6 site and not enough time to upgrade to Drupal 7.

How would you recommend that we deal with "Implementation of..."?

  1. Simply ignore the warning-level message (it's only a warning afterall)
  2. Create a new rule and disable the old one through configuration (duplicate the ruleset.xml file perhaps)
  3. Implement an option in the package that specifies which version of Drupal is being scanned (could be useful for other things)

I'd also say that we're not really strict about forcing people to use "Implementation of..." in Drupal 6 as people sometimes (probably most often) just use "Implements...". However, I'd rather not warn people about the use of "Implementation of..." when it's perfectly valid in Drupal 6. This is why I hesitated and wanted to ask your opinion.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

psynaptic’s picture

Issue summary: View changes
klausi’s picture

You could just "hack" the ruleset.xml like this to disable the hook sniff:

<rule ref="Drupal.Commenting.HookComment">
  <severity>0</severity>
</rule>

Maybe that could also be specified as command line parameter to phpcs.

psynaptic’s picture

Thinking more on this, the problem with that seems to be that we won't get the useful warnings about erroneous hook implementation documentation. We don't care so much if people use "Implements..." vs "Implementation of..." but we do require one or the other to be present and in the correct format.

psynaptic’s picture

Do sniffs have access to the ruleset config? Perhaps I could add an option to allow both versions.

psynaptic’s picture

Status: Active » Needs review
FileSize
3.84 KB

I've added an option which can be used in ruleset.xml as follows:

 <rule ref="Drupal.Commenting.HookComment">
  <properties>
   <property name="strict" value="false"/>
  </properties>
 </rule>

By default the existing behavior is maintained but there is now the option to allow "Implements" and "Implementation of" to pass without generating a warning.

klausi’s picture

Status: Needs review » Closed (won't fix)

Since you can also disable individual sniffs with a phpcs.xml file in your project like Drupal 8 core does I think this is not necessary anymore.