squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.67k stars 1.48k forks source link

4.0.x-dev: Option to ignore if no files were checked instead of exiting with an error code #3556

Open AndreasA opened 2 years ago

AndreasA commented 2 years ago

Describe the bug In our project we sometimes prepare pipelines to be used for future files. However, as those files might not yet exist, phpcs could stop with No files were checked error. The solution is to disable phpcs temporarily but then once the files are there, it might be forgotten to enable them again.

I think instead of always failing, there should be an option to skip this error.

To reproduce Steps to reproduce the behavior:

  1. Run phpcs against an empty directory.

It fails which in most cases is fine but there should be an option to not fail instead.

Expected behavior

Option to ignore if no files were checked.

Versions (please complete the following information):

For now I add a temporary php file that does nothing instead.