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
Stop creating in-memory KtFile when file path is provided #7250
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7250 +/- ##
============================================
- Coverage 84.75% 84.75% -0.01%
- Complexity 3994 3996 +2
============================================
Files 577 577
Lines 12130 12133 +3
Branches 2484 2486 +2
============================================
+ Hits 10281 10283 +2
Misses 624 624
- Partials 1225 1226 +1 ☔ View full report in Codecov by Sentry. |
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.
Is the last commit related with this PR? Any way, LGTM.
This is required when loading KtFile using standard methods
The new methods will create KtFile with virtualPath.path set correctly
The same instance of a KtFile will be reused in some circumstances. To avoid issues the modifiedText must be reset.
It is, yes. If it's not done in AutoCorrectLevelSpec.kt then the tests will fail because the same PsiFile is being reused between tests, and the modified text persists between them. This wasn't a problem before because detekt would always create a new copy of every file it analysed, but that doesn't happen after this PR. There may be scenarios in IDE or other usages where the same PsiFile is also reused so I figured it's safest to defend against that by making a similar change in KtFileModifier.kt |
Waiting on merge of: