Skip to content
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

Don't use PSI for line number calculation #950

Merged
merged 5 commits into from
Jul 2, 2021
Merged

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Jul 1, 2021

What's done:

  • Changed logic
  • Added test

Which rule and warnings did you add?

We were trying to use cached value of line number from PSI ViewProvider, but if the tree is changed in fixMode, ViewProvider is not updated. This causes it to return invalid offsets.

This pull request closes #934

petertrr added 2 commits July 1, 2021 18:19
### What's done:
* Changed logic
* Added test
### What's done:
* Changed logic
* Added test
@codecov
Copy link

codecov bot commented Jul 1, 2021

Codecov Report

Merging #950 (d7f9788) into master (93bfd08) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #950      +/-   ##
============================================
+ Coverage     84.11%   84.13%   +0.02%     
- Complexity     2392     2394       +2     
============================================
  Files           101      101              
  Lines          6030     6025       -5     
  Branches       1783     1780       -3     
============================================
- Hits           5072     5069       -3     
  Misses          263      263              
+ Partials        695      693       -2     
Flag Coverage Δ
unittests 84.13% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...t/rules/chapter3/identifiers/LocalVariablesRule.kt 91.08% <ø> (ø)
...tlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt 85.54% <100.00%> (+0.10%) ⬆️
.../ruleset/rules/chapter3/files/FileStructureRule.kt 83.03% <0.00%> (+0.60%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93bfd08...d7f9788. Read the comment docs.

@petertrr petertrr marked this pull request as ready for review July 1, 2021 15:31
@petertrr petertrr merged commit 70066f6 into master Jul 2, 2021
@petertrr petertrr deleted the bugfix/fp-local#934 branch July 2, 2021 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive rule LOCAL_VARIABLE_EARLY_DECLARATION
2 participants