Skip to content

FunctionSignature and ScopeIndent sniffs don't detect indents correctly when PHP open tag is not on a line by itself #645

@paulschreiber

Description

@paulschreiber

When inspecting co-authors-plus.php with the WordPress-VIP ruleset, phpcbf takes a long time to finish and fails to fix any problems:

The file in question:
https://github.com/Automattic/Co-Authors-Plus/blob/57236fc6856b715d5e27248f6eea5681153645aa/co-authors-plus.php

Here's the output of phpcbf:

$ phpcbf --standard=WordPress-VIP co-authors-plus.php Changing into directory /Users/paul/Co-Authors-Plus Processing co-authors-plus.php [PHP => 13684 tokens in 1592 lines]... DONE in 1.39 secs (30 fixable violations) => Fixing file: 2/30 violations remaining [made 50 passes]... ERROR in 165.13 secs No fixable errors were found Time: 2 mins, 46.55 secs; Memory: 54.75Mb 

Here's the output of phpcs:

$ phpcs --standard=WordPress-VIP co-authors-plus.php FILE: /Users/paul/co-authors-plus.php ---------------------------------------------------------------------- FOUND 63 ERRORS AND 22 WARNINGS AFFECTING 55 LINES ---------------------------------------------------------------------- 38 | ERROR | [ ] Class name "coauthors_plus" is not in camel | | caps format 335 | ERROR | [ ] Use Yoda Condition checks, you must 369 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$count' 381 | ERROR | [ ] Expected next thing to be an escaping function | | (like esc_html_e() or esc_attr_e()), not '_e' 388 | ERROR | [ ] Expected next thing to be an escaping function | | (like esc_html_e() or esc_attr_e()), not '_e' 421 | ERROR | [ ] Use Yoda Condition checks, you must 425 | ERROR | [ ] Use Yoda Condition checks, you must 438 | ERROR | [ ] Use Yoda Condition checks, you must 510 | ERROR | [ ] Expected next thing to be an escaping function | | (like esc_html_e() or esc_attr_e()), not '_e' 512 | ERROR | [ ] Expected next thing to be an escaping function | | (like esc_html_e() or esc_attr_e()), not '_e' 526 | WARNING | [ ] Usage of a direct database call is discouraged. 526 | ERROR | [ ] Usage of a direct database call without caching | | is prohibited. Use wp_cache_get / wp_cache_set. 529 | ERROR | [ ] get_term_by is prohibited, please use | | wpcom_vip_get_term_by() instead. 550 | WARNING | [ ] Usage of a direct database call is discouraged. 550 | ERROR | [ ] Usage of a direct database call without caching | | is prohibited. Use wp_cache_get / wp_cache_set. 552 | ERROR | [ ] get_term_by is prohibited, please use | | wpcom_vip_get_term_by() instead. 594 | WARNING | [ ] Usage of a direct database call is discouraged. 594 | ERROR | [ ] Usage of a direct database call without caching | | is prohibited. Use wp_cache_get / wp_cache_set. 595 | WARNING | [ ] Usage of a direct database call is discouraged. 621 | ERROR | [x] String "INNER JOIN" does not require double | | quotes; use single quotes instead 621 | ERROR | [x] String "LEFT JOIN" does not require double | | quotes; use single quotes instead 624 | ERROR | [x] String "INNER JOIN" does not require double | | quotes; use single quotes instead 624 | ERROR | [x] String "LEFT JOIN" does not require double | | quotes; use single quotes instead 729 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 771 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 771 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 774 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 774 | ERROR | [ ] Detected usage of a non-sanitized input | | variable: $_POST 822 | ERROR | [x] Expected 1 space after closing parenthesis; | | found 0 847 | WARNING | [ ] Usage of a direct database call is discouraged. 863 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 863 | WARNING | [ ] Detected access of super global var $_POST, | | probably need manual inspection. 871 | WARNING | [ ] Usage of a direct database call is discouraged. 871 | ERROR | [ ] Usage of a direct database call without caching | | is prohibited. Use wp_cache_get / wp_cache_set. 896 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 896 | ERROR | [ ] Use Yoda Condition checks, you must 905 | WARNING | [ ] Usage of a direct database call is discouraged. 905 | ERROR | [ ] Usage of a direct database call without caching | | is prohibited. Use wp_cache_get / wp_cache_set. 1042 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 1042 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 1042 | ERROR | [ ] Detected usage of a non-sanitized input | | variable: $_REQUEST 1046 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 1050 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 1050 | ERROR | [ ] Detected usage of a non-sanitized input | | variable: $_REQUEST 1051 | WARNING | [ ] Detected access of super global var $_REQUEST, | | probably need manual inspection. 1051 | ERROR | [ ] Detected usage of a non-validated input | | variable: $_REQUEST 1051 | ERROR | [ ] Detected usage of a non-sanitized input | | variable: $_REQUEST 1056 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$author' 1056 | ERROR | [x] String " | " does not require double quotes; | | use single quotes instead 1056 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$author' 1056 | ERROR | [x] String " | " does not require double quotes; | | use single quotes instead 1056 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$author' 1056 | ERROR | [x] String " | " does not require double quotes; | | use single quotes instead 1056 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$author' 1056 | ERROR | [x] String " | " does not require double quotes; | | use single quotes instead 1056 | ERROR | [ ] Expected next thing to be a escaping function, | | not '$author' 1136 | ERROR | [x] String "user_nicename LIKE" does not require | | double quotes; use single quotes instead 1136 | ERROR | [x] String "display_name LIKE" does not require | | double quotes; use single quotes instead 1233 | ERROR | [ ] Expected a sanitizing function (see Codex for | | 'Data Validation'), but instead saw | | 'add_query_arg' 1234 | ERROR | [x] Multi-line function call not indented | | correctly; expected 4 spaces but found 20 1238 | ERROR | [x] Multi-line function call not indented | | correctly; expected 4 spaces but found 20 1239 | ERROR | [x] Multi-line function call not indented | | correctly; expected 0 spaces but found 16 1317 | ERROR | [ ] get_term_by is prohibited, please use | | wpcom_vip_get_term_by() instead. 1319 | ERROR | [ ] get_term_by is prohibited, please use | | wpcom_vip_get_term_by() instead. 1457 | ERROR | [x] Line indented incorrectly; expected at least 1 | | tabs, found 0 1468 | ERROR | [x] Line indented incorrectly; expected 1 tabs, | | found 0 1469 | ERROR | [x] Line indented incorrectly; expected at least 2 | | tabs, found 1 1470 | ERROR | [x] Line indented incorrectly; expected at least 2 | | tabs, found 1 1471 | ERROR | [x] Line indented incorrectly; expected at least 2 | | tabs, found 1 1472 | ERROR | [x] Line indented incorrectly; expected 2 tabs, | | found 1 1474 | ERROR | [x] Line indented incorrectly; expected at least 3 | | tabs, found 2 1475 | ERROR | [x] Line indented incorrectly; expected 3 tabs, | | found 2 1476 | ERROR | [x] Line indented incorrectly; expected at least 4 | | tabs, found 3 1489 | WARNING | [ ] Silencing errors is discouraged 1538 | WARNING | [ ] Detected access of super global var $_SERVER, | | probably need manual inspection. 1538 | ERROR | [ ] Detected usage of a non-validated input | | variable: $_SERVER 1538 | ERROR | [ ] Detected usage of a non-sanitized input | | variable: $_SERVER 1553 | ERROR | [x] String "Content-Type: text/plain; charset=\"" | | does not require double quotes; use single | | quotes instead 1555 | ERROR | [x] Expected 1 spaces after opening bracket; 0 | | found 1555 | ERROR | [x] Expected 1 spaces before closing bracket; 0 | | found 1563 | WARNING | [ ] Silencing errors is discouraged 1581 | ERROR | [x] Expected 1 spaces after opening bracket; 0 | | found 1581 | ERROR | [x] Expected 1 spaces before closing bracket; 0 | | found 1584 | ERROR | [x] Expected 1 spaces after opening bracket; 0 | | found 1584 | ERROR | [x] Expected 1 spaces before closing bracket; 0 | | found ---------------------------------------------------------------------- PHPCBF CAN FIX THE 30 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- Time: 1.39 secs; Memory: 25.75Mb 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions