Skip to content

phpcs plugin ignores "path" setting #153

Description

@leewillis77

Expected behavior

phpcs only run on the path defined in the .php-censor.yml file, e.g.

test:
    php_code_sniffer:
        path: "app"

phpcs should only check and report errors on files under the "app" folder. This config looks correct according to the docs, and works on PHPCI.

Actual behavior

The path is ignored, and phpcs is run against the full project. Debug output below:

RUNNING PLUGIN: PHP Code Sniffer (Stage: Test)
Plugin options: {"standard":"\/phpcs.xml","path":"app","allowed_warnings":10,"allowed_errors":5}
Looking for binary: phpcs
Found in ./vendor/bin (local): phpcs
Args: ["\/var\/www\/phpcensor\/runtime\/builds\/5_24c5e\/vendor\/bin\/phpcs --report=json %s %s %s %s %s \"%s\" %s %s %s"," --standard=\/var\/www\/phpcensor\/runtime\/builds\/5_24c5e\/\/phpcs.xml"," --extensions=php"," --ignore=vendor","","","\/var\/www\/phpcensor\/runtime\/builds\/5_24c5e\/","","",""]
Command: ./vendor/bin/phpcs --report=json  --standard=.//phpcs.xml  --extensions=php  --ignore=vendor   "./"   
Execution status: 2
PLUGIN: SUCCESS

Note the final "Command" output which shows that phpcs is running against ./, not app.

Steps to reproduce

  • Limit the path in .php-censor.yml, make sure a file outside that path has errors that will be flagged.
  • Run build.
  • Confirm that errors in files outside of the path are reported

Environment

PHP: 7.1.13
PHP-Censor: 0.20.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions