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

Bugfix of NPE in complex binary expressions in long line rule #983

Merged
merged 8 commits into from
Jul 16, 2021

Conversation

kgevorkyan
Copy link
Member

@kgevorkyan kgevorkyan commented Jul 16, 2021

What's done:

  • Fix NPE in long binary expressions: previously in complex cases binList could hold incorrect nodes, which had no binary expression as first common parent
  • Fix out of range error in long string templates
  • Add tests

### What's done:
* Debug
### What's done:
* Debug
### What's done:
* WIP
### What's done:
* WIP
### What's done:
* Polish
@codecov
Copy link

codecov bot commented Jul 16, 2021

Codecov Report

Merging #983 (b1e2c97) into master (502baa7) will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #983   +/-   ##
=========================================
  Coverage     83.81%   83.81%           
- Complexity     2407     2409    +2     
=========================================
  Files           102      102           
  Lines          6079     6081    +2     
  Branches       1797     1799    +2     
=========================================
+ Hits           5095     5097    +2     
  Misses          269      269           
  Partials        715      715           
Flag Coverage Δ
unittests 83.81% <83.33%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...g/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt 92.43% <83.33%> (+0.06%) ⬆️

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 502baa7...b1e2c97. Read the comment docs.

@kgevorkyan kgevorkyan linked an issue Jul 16, 2021 that may be closed by this pull request
@kgevorkyan
Copy link
Member Author

Despite the fact, that for now we get rid of NPE and cover this case by tests, we still have issue on related functionality #984

I think, we can consider it in future PR

@kgevorkyan kgevorkyan marked this pull request as ready for review July 16, 2021 13:02
if (it.elementType == REFERENCE_EXPRESSION && it.treeParent.elementType == CALL_EXPRESSION) {
binList.add(it.treeParent)
if (it.elementType == REFERENCE_EXPRESSION && it.treeParent?.elementType == CALL_EXPRESSION) {
binList.tryAdd(it.treeParent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we add the same element multiple times here? How could it be?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks, I did a lot of experiments with dfsForProperty and it's remain from them, now it's not necessary, removed.

@kgevorkyan kgevorkyan merged commit ae307fe into master Jul 16, 2021
@kgevorkyan kgevorkyan deleted the bugfix/npe_long_line_rule branch July 16, 2021 15:19
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.

NPE in Long Line Rule
2 participants