PHP CodeSniffer: indentation of 2 is ignored, it just checks 4

Posted by Olivier Pons on Pro Webmasters See other posts from Pro Webmasters or by Olivier Pons
Published on 2012-04-13T15:27:12Z Indexed on 2012/04/13 17:43 UTC
Read the original article Hit count: 466

Filed under:
|
# 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?

© Pro Webmasters or respective owner

Related posts about php

Related posts about code-quality