Home WordPress Coding standards precision sniff issue
Reply: 0

WordPress Coding standards precision sniff issue

dingo_d
1#
dingo_d Published in 2018-02-14 09:55:42Z

After updating to the latest wpcs version I'm getting precision alignment warnings in my file. And it's happening for comments for the properties in my class. For instance

<?php
/**
 * FIle that holds the test class
 *
 * @since   1.0.0
 * @package test
 */

namespace Namespace\Admin;

/**
 * Test class
 *
 * @since  1.0.0
 */
class Test {
  /**
   * Global theme name
   *
   * @var string
   *
   * @since 1.0.0
   */
  protected $theme_name;
}

I am using 2 spaces for spacing instead 4 spaces, and spaces instead of tabs in my ruleset.

<!-- Tabs should represent 2 spaces. -->
  <arg name="tab-width" value="2"/>

  <!-- Set the default indent value and force spaces instead of tabs -->
  <rule ref="WordPress">
    <exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
  </rule>
  <rule ref="Generic.WhiteSpace.ScopeIndent">
    <properties>
      <property name="indent" value="2"/>
      <property name="tabIndent" value="false"/>
    </properties>
  </rule>
  <rule ref="Generic.WhiteSpace.DisallowTabIndent" />

  <rule ref="PEAR.Functions.FunctionCallSignature">
    <properties>
      <property name="indent" value="2"/>
    </properties>
  </rule>

I tried adding the T_DOC_COMMENT_WHITESPACE to ignoreAlignmentTokens

  <!-- Precision alignment sniff -->
  <rule ref="WordPress.WhiteSpace.PrecisionAlignment">
    <properties>
      <property name="ignoreAlignmentTokens" type="array" value="T_COMMENT,T_INLINE_HTML,T_DOC_COMMENT_WHITESPACE"/>
    </properties>
  </rule>

But I'm still getting the warning about the precision alignment of 2 spaces on my doc block and on my property.

Can this be silenced, or am I missing something?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.593631 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO