php-code-sniffer-baseliner icon indicating copy to clipboard operation
php-code-sniffer-baseliner copied to clipboard

Baseliner does not add ignore lines for warnings when there are 0 errors

Open peterjaap opened this issue 2 years ago • 3 comments

Our CI fails when phpcs returns warnings, however, this package does not add warnings to the baseline, only errors.

So when I run the baseliner I get;

Running PHP_CodeSniffer (this may take a while)...
PHP_CodeSniffer did not report any errors.

But when I run phpcs;

$ vendor/bin/grumphp run --tasks phpcs -n

GrumPHP is sniffing your code!                                                                                                               
                                                                                                                                             
Running tasks with priority 0!                                                                                                               
==============================                                                                                                               
                                                                                                                                             
Running task 1/1: phpcs... ✘                                                                                                                 
                                                                                                                                             
phpcs                                                                                                                                        
=====                                                                                                                                        
              
....

And it finds a lot of warnings and exits with non-zero error code, making our pipeline fail.

I could add <config name="ignore_warnings_on_exit" value="1" /> to phpcs.xml, but then there's no record of these errors in the baseline, which is what I prefer.

Is it possible to add a flag to also create a baseline for phpcs warnings, not just errors?

peterjaap avatar Nov 16 '22 10:11 peterjaap