Automattic / vip-scanner

Deprecated: Scan all sorts of themes and files and things! Use PHPCS and the VIP coding standards instead
https://automattic.com
140 stars 51 forks source link

scan-theme CLI command hides errors without lines #118

Open rmccue opened 10 years ago

rmccue commented 10 years ago

If you have errors without lines, these will be hidden from the scan-theme output, which is incredibly confusing.

Adding --format=json will show this, but JSON isn't the best format for humans.

david-binda commented 9 years ago

@rmccue thank you for ticketing this. I was just about to look into this issue but can not reproduce it. (I was testing it agains random themes).

Could you, pls, let me know with what theme are you having issues you are describing? And what is the command you are using?

Here's a JSON output for https://wordpress.org/themes/inkzine theme:

wp vip-scanner scan-theme --theme=inkzine --format=json https://gist.github.com/david-binda/df8940312d6974b0ab9c

and a standard one: wp vip-scanner scan-theme --theme=inkzine

+---------+-------------------------------------------------------------------------------+--------------------------------------------------------------------------------+----------------------------+
| level   | description                                                                   | lines                                                                          | file                       |
+---------+-------------------------------------------------------------------------------+--------------------------------------------------------------------------------+----------------------------+
| warning | Antivirus Scan                                                                | ClamAV is not present on this system - as such, no antivirus scanning was perf |                            |
|         |                                                                               | ormed on this theme.                                                           |                            |
| warning | PHP CodeSniffer not available                                                 | PHP CodeSniffer (phpcs) is not available on this system. No code sniffing will |                            |
|         |                                                                               |  be performed.                                                                 |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | 404.php                    |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | archive.php                |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | author.php                 |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | category.php               |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | date.php                   |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | home.php                   |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | image.php                  |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | wp_bootstrap_navwalker.php |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | index.php                  |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | page-full-width.php        |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | page.php                   |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | search.php                 |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | showcase.php               |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | single.php                 |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | tag.php                    |
|         | put errors.                                                                   |                                                                                |                            |
| warning | Closing PHP tag at the end of file. Remove to avoid accidental whitespace out |                                                                                | video.php                  |
|         | put errors.                                                                   |                                                                                |                            |
| Warning | Uncached function. Use WP_Query or ensure suppress_filters is false           | $lastposts = get_posts( $args );                                               | header.php                 |
| Warning | Reads entire file into an array                                               | /* Loads the file for option sanitization */                                   | options-framework.php      |
| Warning | Reads entire file into an array                                               | FILE__ ) . '/options-sanitize.php';                                            | options-framework.php      |
| Warning | Reads entire file into an array                                               | // Include the required files                                                  | options-framework.php      |
| Warning | Reads entire file into an array                                               | FILE__ ) . '/options-interface.php';                                           | options-framework.php      |
| Warning | Reads entire file into an array                                               | FILE__ ) . '/options-media-uploader.php';                                      | options-framework.php      |
| Warning | Reads entire file into an array                                               | // Optionally Loads the options file from the theme                            | options-framework.php      |
| Warning | Reads entire file into an array                                               | $optionsfile = locate_template( $location );                                   | options-framework.php      |
| Warning | Reads entire file into an array                                               | * file will be added to the option for the active theme.                       | options-framework.php      |
| Warning | Reads entire file into an array                                               | // Load options from options.php file (if it exists)                           | options-framework.php      |
| Warning | Reads entire file into an array                                               | if ( $optionsfile = locate_template( $location ) ) {                           | options-framework.php      |
| Warning | Reads entire file into an array                                               | $maybe_options = require_once $optionsfile;                                    | options-framework.php      |
| Warning | Uncached function. Use WP_Query or ensure suppress_filters is false           | $attachment_ids = get_posts( array(                                            | template-tags.php          |
| Warning | Possible output of restricted variables                                       |                                                                                | options-framework.php      |
| Warning | Possible output of restricted variables                                       |                                                                                | template-tags.php          |
| blocker | VIP Init                                                                      | vip-init.php was not required                                                  | functions.php              |
| Blocker | Explicitly define variables rather than using extract()                       | extract( $args );                                                              | wp_bootstrap_navwalker.php |
| Blocker | Attribution link missing, please use <a href="http://vip.wordpress.com/docume |                                                                                |                            |
|         | ntation/powered-by-wordpress-com-vip/">vip_powered_wpcom()</a>                |                                                                                |                            |
| Note    | Getting option                                                                | &amp;lt;?php if ( get_comment_pages_count() &amp;gt; 1 &amp;amp;&amp;amp; get_ | comments.php               |
|         |                                                                               | option( 'page_comments' ) ) : // are there comments to navigate through        |                            |
| Note    | Getting option                                                                | &amp;lt;?php if ( get_comment_pages_count() &amp;gt; 1 &amp;amp;&amp;amp; get_ | comments.php               |
|         |                                                                               | option( 'page_comments' ) ) : // are there comments to navigate through        |                            |
| Note    | Getting option                                                                | $req = get_option( 'require_name_email' );                                     | comments.php               |
| Note    | Getting option                                                                | if ( (function_exists( 'of_get_option' )) &amp;amp;&amp;amp; (of_get_option('s | functions.php              |
|         |                                                                               | idebar-layout', true) != 1) ) {                                                |                            |
| Note    | Getting option                                                                | if (of_get_option('sidebar-layout', true) ==  'right') {                       | functions.php              |
| Note    | Getting option                                                                | if ( is_singular() &amp;amp;&amp;amp; comments_open() &amp;amp;&amp;amp; get_o | functions.php              |
|         |                                                                               | ption( 'thread_comments' ) ) {                                                 |                            |
| Note    | Getting option                                                                | if ( (function_exists( 'of_get_option' )) &amp;amp;&amp;amp; (of_get_option('h | functions.php              |
|         |                                                                               | eadcode1', true) != 1) ) {                                                     |                            |
| Note    | Getting option                                                                | echo of_get_option('headcode1', true);                                         | functions.php              |
| Note    | Getting option                                                                | if ( (function_exists( 'of_get_option' )) &amp;amp;&amp;amp; (of_get_option('s | functions.php              |
|         |                                                                               | tyle2', true) != 1) ) {                                                        |                            |
| Note    | Getting option                                                                | echo '&amp;lt;style&amp;gt;'.of_get_option('style2', true).'&amp;lt;/style&amp | functions.php              |
|         |                                                                               | ;gt;';                                                                         |                            |
| Note    | Getting option                                                                | if ( ( ( of_get_option('slider_enabled') != 0 ) &amp;amp;&amp;amp; (is_home()  | functions.php              |
|         |                                                                               | ) )                                                                            |                            |
| Note    | Getting option                                                                | || ( (of_get_option('slider_enabled_front') != 0 ) &amp;amp;&amp;amp; (is_fron | functions.php              |
|         |                                                                               | t_page() ) ) )                                                                 |                            |
| Note    | Getting option                                                                | if ( of_get_option('credit1', true) != 0 ) {                                   | functions.php              |
| Note    | Updating option                                                               | update_option( 'optionsframework', $optionsframework_settings );               | options-framework.php      |
| Note    | Updating option                                                               | update_option( 'optionsframework', $optionsframework_settings );               | options-framework.php      |
| Note    | Updating option                                                               | update_option( 'optionsframework', $optionsframework_settings );               | options-framework.php      |
| Note    | Updating option                                                               | update_option( 'optionsframework', $optionsframework_settings );               | options-framework.php      |
| Note    | Getting option                                                                | $optionsframework_settings = get_option('optionsframework' );                  | options-framework.php      |
| Note    | Getting option                                                                | $default_themename = get_option( 'stylesheet' );                               | options-framework.php      |
| Note    | Getting option                                                                | if ( ! get_option( $optionsframework_settings['id'] ) ) {                      | options-framework.php      |
| Note    | Getting option                                                                | $optionsframework_settings = get_option( 'optionsframework' );                 | options-framework.php      |
| Note    | Getting option                                                                | if ( ! function_exists( 'of_get_option' ) ) {                                  | options-framework.php      |
| Note    | Getting option                                                                | function of_get_option( $name, $default = false ) {                            | options-framework.php      |
| Note    | Getting option                                                                | $config = get_option( 'optionsframework' );                                    | options-framework.php      |
| Note    | Getting option                                                                | $options = get_option( $config['id'] );                                        | options-framework.php      |
| Note    | Adding Option                                                                 | * http://codex.wordpress.org/Function_Reference/add_option                     | options-framework.php      |
| Note    | Adding Option                                                                 | add_option( $option_name, $values ); // Add option with default settings       | options-framework.php      |
| Note    | Getting option                                                                | $optionsframework_settings = get_option( 'optionsframework' );                 | options-interface.php      |
| Note    | Getting option                                                                | $settings = get_option($option_name);                                          | options-interface.php      |
| Note    | Getting option                                                                | $optionsframework_settings = get_option( 'optionsframework' );                 | options-media-uploader.php |
| Note    | Updating option                                                               | update_option( 'optionsframework', $optionsframework_settings );               | options.php                |
| Note    | Getting option                                                                | $optionsframework_settings = get_option( 'optionsframework' );                 | options.php                |
| Note    | Working with superglobals                                                     | * @uses $_POST['reset'] to restore default options                             | options-framework.php      |
| Note    | Working with superglobals                                                     | if ( isset( $_POST['reset'] ) ) {                                              | options-framework.php      |
| Note    | Working with superglobals                                                     | * This used to check for $_POST['update'], but has been updated                | options-framework.php      |
| Note    | Working with superglobals                                                     | // Set checkbox to false if it wasn't sent in the $_POST                       | options-framework.php      |
| Note    | Working with superglobals                                                     | // Set each item in the multicheck to false if it wasn't sent in the $_POST    | options-framework.php      |
| Note    | Working with superglobals                                                     | $GLOBALS['comment'] = $comment;                                                | template-tags.php          |
+---------+-------------------------------------------------------------------------------+--------------------------------------------------------------------------------+----------------------------+