Mobile app version of vmapp.org
Login or Join
Fox8124981

: PHP CodeSniffer: indentation of 2 is ignored, it just checks 4 # phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net) # Trying to do this: phpcs --tab-width=2

@Fox8124981

Posted in: #CodeQuality #Php

# phpcs --version
PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net)
#


Trying to do this:

phpcs --tab-width=2 includes/json/item/categorie.php
FOUND 29 ERROR(S) AND 3 WARNING(S) AFFECTING 24 LINE(S)


Doesn't work.
This doesn't work too:

phpcs includes/json/item/categorie.php --tab-width=2
FOUND 29 ERROR(S) AND 3 WARNING(S) AFFECTING 24 LINE(S)


If I indent the file with 4 spaces (which I don't want):

phpcs --tab-width=2 includes/json/item/categorie.php
FOUND 4 ERROR(S) AND 3 WARNING(S) AFFECTING 17 LINE(S)
phpcs --tab-width=4 includes/json/item/categorie.php
FOUND 4 ERROR(S) AND 3 WARNING(S) AFFECTING 17 LINE(S)
phpcs --tab-width=50 includes/json/item/categorie.php
FOUND 4 ERROR(S) AND 3 WARNING(S) AFFECTING 17 LINE(S)
phpcs includes/json/item/categorie.php --tab-width=50
FOUND 4 ERROR(S) AND 3 WARNING(S) AFFECTING 17 LINE(S)


So it's totally ignored. It this a bug?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Sorry, my bad:

# phpcs --help
Usage: phpcs [-nwlsapvi] [-d key[=value]]
...blabla...
<tabWidth> The number of spaces each tab represents
...blabla...


This means "when there's the tab character, how many spaces does it represent".

There's nothing to do with indentation of "4" which seems to be hard-coded.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme