Page MenuHomePhabricator

DisallowSpaceIndent sniff fails to detect incorrect use of spaces
Open, MediumPublic

Description

See https://gerrit.wikimedia.org/r/#/c/401410/3/maintenance/loginAttempt.php

I had accidentally used two spaces instead of a tab in certain lines, and CodeSniffer failed to detect it.

class LoginAttempt extends Maintenance {
»	/**
»	 * Constructor
»	 *
»	 * Retrieves the arguments from the command line
»	 */
  public function __construct() {
^^ problem
»	»	parent::__construct();
»	»	$this->requireExtension( 'LoginNotify' );
»	}
}

Event Timeline

It seems Generic.WhiteSpace.DisallowSpaceIndent is only triggered when the count of spaces is equal to the usually tab width of 4, more or less spaces are not checked by that sniff (from my understanding of the code).

So this needs an own sniff or a option for the usptream one.

Krinkle renamed this task from CodeSniffer failed to detect incorrect use of spaces to DisallowSpaceIndent sniff fails to detect incorrect use of spaces.Apr 16 2018, 11:43 PM
Krinkle moved this task from Untriaged to Accepted rule changes on the MediaWiki-Codesniffer board.
Krinkle triaged this task as Medium priority.Sep 8 2019, 1:27 AM
Krinkle updated the task description. (Show Details)