Ignore errors/warnings which are ignored #486
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While working on #481, I noticed that the
fixableCount
property had an incorrect value. Upon investigation, I found that issues with severity zero are still being included in the count for how many issues can be fixed. This is misleading, as runningphpcbf
does not fix these.Unfortunately there don't appear to be any tests which cover this functionality, so getting suitable test coverage may be considered a blocker to this pull request.
Reproduction details
In order to reproduce this bug, run the following commands:
php bin/phpcbf autoload.php
to fix any fixable errors. Notice that there are no errors reported as fixable.php bin/phpcs --cache=local-test-file.json autoload.php
to create a cache file. Notice that there are no errors reported (fixable or otherwise).jq < local-test-file.json '.["'$PWD'/autoload.php"] | "\(.errorCount) errors, \(.warningCount) warning, \(.fixableCount) fixable issues"'
to see the number of errors/warnings/fixable recorded in the cache.I expect these to match the output of
phpcs
, but they are all non-zero.Suggested changelog entry
Fix bug where internal property
fixableCount
was incorrectly including issues with severity zero.Related issues/external references
This is related #481 - without this change, that pull request is somewhat less effective.
Types of changes
PR checklist