Report/Code: fix fatal potential fatal error when combined with Diff report #955
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
Okay, so this is an awkward one.
If both the
Code+ theDiffreport were requested + caching was turned on + the order of the requested reports wasCode,Diff(i.e. first the code report), the following fatal error would occur:To reproduce the issue (on
master):Some investigating later, it turns out that both the
Codereport, as well as theDiffreport, re-parse the current file, with theDiffreport initializing the fixer once the file has reparsed, but theCodereport not doing so (as it doesn't need the fixer). The problem with that is that theCodereport basically leaves theFixerin an invalid state, leading to the above error.While it is up for debate whether reports should ever (be allowed to) re-parse files, for now, let's fix the fatal.
Re-evaluating the report setup should definitely be done, but should probably wait until the Reports classes have test coverage.
Suggested changelog entry
Prevent a potential race condition when both the
Diff+ theCodereports are requested and caching is on.Types of changes