Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

DaveLak/phpcs-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPCS Differing Results POC

This repo shows PHPCS will provide different results when running against single and multiple files.

To reproduce the issue:

  1. git clone this repo and cd into the project root
  2. composer install to install dependencies
  3. Run ./vendor/bin/phpcs
  4. Run ./vendor/bin/phpcs category.php
  5. Notice PHPCS flags warnings in category.php only when run against the project

Expected output of ./vendor/bin/phpcs:

W. 2 / 2 (100%)

FILE: /path/to/phpcs_poc/functions.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 14 | WARNING | Comment refers to a TODO task "Load this conditionally"
    |         | (Generic.Commenting.Todo.TaskFound)
 16 | WARNING | In footer ($in_footer) is not set explicitly wp_enqueue_script; It is
    |         | recommended to load scripts in the footer. Please set this value to
    |         | `true` to load it in the footer, or explicitly `false` if it should be
    |         | loaded in the header.
    |         | (WordPress.WP.EnqueuedResourceParameters.NotInFooter)
----------------------------------------------------------------------------------------

Actual output of ./vendor/bin/phpcs:

WW 2 / 2 (100%)

FILE: /path/to/phpcs_poc/functions.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 13 | WARNING | Comment refers to a TODO task "Load this conditionally"
    |         | (Generic.Commenting.Todo.TaskFound)
 15 | WARNING | In footer ($in_footer) is not set explicitly wp_enqueue_script; It is
    |         | recommended to load scripts in the footer. Please set this value to
    |         | `true` to load it in the footer, or explicitly `false` if it should be
    |         | loaded in the header.
    |         | (WordPress.WP.EnqueuedResourceParameters.NotInFooter)
----------------------------------------------------------------------------------------
FILE: /path/to/phpcs_poc/category.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 11 | WARNING | Found precision alignment of 1 spaces.
    |         | (WordPress.WhiteSpace.PrecisionAlignment.Found)
 12 | WARNING | Found precision alignment of 1 spaces.
    |         | (WordPress.WhiteSpace.PrecisionAlignment.Found)
----------------------------------------------------------------------------------------

Output of ./vendor/bin/phpcs category.php:

. 1 / 1 (100%)

Time: 132ms; Memory: 8Mb

Output of ./vendor/bin/phpcs functions.php:

W 1 / 1 (100%) 

FILE: /path/to/phpcs_poc/functions.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 13 | WARNING | Comment refers to a TODO task "Load this conditionally"
    |         | (Generic.Commenting.Todo.TaskFound)
 15 | WARNING | In footer ($in_footer) is not set explicitly wp_enqueue_script; It is
    |         | recommended to load scripts in the footer. Please set this value to
    |         | `true` to load it in the footer, or explicitly `false` if it should be
    |         | loaded in the header.
    |         | (WordPress.WP.EnqueuedResourceParameters.NotInFooter)
----------------------------------------------------------------------------------------

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages