Skip to content

phpcs ignores configuration files #248

Closed as not planned
Closed as not planned
@jefhar

Description

@jefhar

Describe the bug

PHP_CodeSniffer ignores .phpcs.xml, phpcs.xml, .phpcs.xml.dist, phpcs.xml.dist

To reproduce

Steps to reproduce the behavior:

$ composer require --dev "squizlabs/php_codesniffer=*"
<<composer stuff>>
$ vendor/bin/phpcs --config-set default_standard PSR2
$ vendor/bin/phpcs --config-show
Using config file: /Users/me/newestProject/vendor/squizlabs/php_codesniffer/CodeSniffer.conf

default_standard: PSR2
report_format:    summary
report_width:     120
show_progress:    1
show_warnings:    0

$ cp vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml .phpcs.xml
$ cp vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml phpcs.xml
$ cp vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml .phpcs.xml.dist
$ cp vendor/squizlabs/php_codesniffer/src/Standards/PSR12/ruleset.xml phpcs.xml.dist
$ vendor/bin/phpcs --config-show
Using config file: /Users/me/newestProject/vendor/squizlabs/php_codesniffer/CodeSniffer.conf

default_standard: PSR2
report_format:    summary
report_width:     120
show_progress:    1
show_warnings:    0

Expected behavior

I expect the my default configuration file to be used.

Versions (please complete the following information)

Operating System MacOS 14.2.1
PHP version PHP 8.3.1 (cli)
PHP_CodeSniffer version PHP_CodeSniffer version 3.8.0 (stable) by Squiz and PHPCSStandards
Standard N/A
Install type local composer

Additional context

CLI output mentions a file in the vendor folder, which in no way is conducive to having a configuration shareable.

Please confirm:

  • I have searched the issue list and am not opening a duplicate issue.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.

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