-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force empty lines non executable #805
Force empty lines non executable #805
Conversation
Codecov Report
@@ Coverage Diff @@
## master #805 +/- ##
============================================
+ Coverage 82.96% 83.01% +0.04%
- Complexity 1111 1118 +7
============================================
Files 60 60
Lines 3411 3421 +10
============================================
+ Hits 2830 2840 +10
Misses 581 581
Continue to review full report at Codecov.
|
$sourceLines = explode("\n", file_get_contents($filename)); | ||
|
||
foreach ($coverage as $line => $lineCoverage) { | ||
if (is_array($lineCoverage) && trim($sourceLines[$line - 1]) === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is_array
isn't technically necessary, without it empty lines that are already non-executable are simply marked non-executable again. However I found it helpful for debugging to ensure that this only triggered on the cases I was expecting it to
The downside of keeping this separate is that the result of this analysis does not get cached. |
@dvdoug @sebastianbergmann it looks like this didn't solve the issue (or perhaps I'm doing something wrong?): lcobucci/jwt#380 |
@sebastianbergmann in v9.3.4 this component was relying on the driver to detect "dead code" (9.1.4...master#diff-b2fbc27b0e544bbffcdfba89b3fb1dd4L640), can the removal of that bit be cause of the problem? |
The issue of the executable last line was originally raised in the context of reporting being incorrect, hence the implemention decision that:
Those CI runs would appear to suggest that strict covers annotations means that it's not OK to do the analysis and adjustment as a one-off after the suite completes but requires it to be performed after each individual test invocation instead? That's annoying and will definitely want some caching 😢 I am happy to look into this more, but please note I am not likely to have time before next week |
No worries, take your time. I will look into reverting the recent changes and roll a new release later today. |
To hopefully fix #799
This isn't quite the same concept as an "ignored line" so I've deliberately kept this implementation distinct from the static analysis code. It's done as a single pass at the end of execution for speed, although it also simplifies the code.