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

Fix for ArrayIndexOutOfBoundsException in #371 #612

Merged
merged 8 commits into from
Dec 7, 2020
Merged

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Dec 4, 2020

What's done:

  • Changed logic
  • Added tests

This pull request closes #371

### What's done:
* Changed logic
@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #612 (17dc903) into master (ac92d54) will increase coverage by 0.01%.
The diff coverage is 86.36%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #612      +/-   ##
============================================
+ Coverage     80.73%   80.75%   +0.01%     
+ Complexity     1746     1745       -1     
============================================
  Files            89       89              
  Lines          4614     4613       -1     
  Branches       1386     1385       -1     
============================================
  Hits           3725     3725              
  Misses          322      322              
+ Partials        567      566       -1     
Flag Coverage Δ Complexity Δ
unittests 80.75% <86.36%> (+0.01%) 0.00 <4.00> (ø)

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

Impacted Files Coverage Δ Complexity Δ
...tlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt 84.82% <72.72%> (+0.82%) 0.00 <0.00> (ø)
...at/ruleset/rules/identifiers/LocalVariablesRule.kt 92.42% <100.00%> (ø) 24.00 <4.00> (ø)
...fn/diktat/ruleset/rules/classes/DataClassesRule.kt 83.33% <0.00%> (-2.39%) 25.00% <0.00%> (-1.00%)

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 ac92d54...17dc903. Read the comment docs.

@petertrr petertrr changed the title Fix for ArrayIndexOutOfBounndsException in #371 Fix for ArrayIndexOutOfBoundsException in #371 Dec 7, 2020
} else {
calculateLineNumber()
}
fun ASTNode.getLineNumber(): Int? =
Copy link
Member

Choose a reason for hiding this comment

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

Why it should return nullable??

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I use non-null assert on every call. I'll check and throw error here and return non-nullable value.

Copy link
Member

@orchestr7 orchestr7 left a comment

Choose a reason for hiding this comment

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

lgtm

@petertrr petertrr merged commit ca50c60 into master Dec 7, 2020
@petertrr petertrr deleted the bugfix/ioobe#371 branch December 7, 2020 14:21
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.

IndexOutOfBoundsException when calculating line number in fixing mode
2 participants