-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fixing an NPE related to an Identifier Name #1111
Conversation
### What's done: - typos in warnings
…PE-identifier-name
### What's done: - we expected that variables can only be declared in Classes (forgot about objects)
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
Outdated
Show resolved
Hide resolved
@@ -216,7 +194,7 @@ class IdentifierNaming(configRules: List<RulesConfig>) : DiktatRule( | |||
}) { | |||
// For class members also check `@property` KDoc tag. | |||
// If we are here, then `variableName` is definitely a node from a class. |
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.
Then this comment is false?
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.
node from a class OR an object...
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.
also I made it NULL-safe. No more chances for an NPE here
@@ -216,7 +194,7 @@ class IdentifierNaming(configRules: List<RulesConfig>) : DiktatRule( | |||
}) { | |||
// For class members also check `@property` KDoc tag. | |||
// If we are here, then `variableName` is definitely a node from a class. | |||
variableName.parent(CLASS)!!.findChildByType(KDOC)?.kDocTags() | |||
variableName.parent(CLASS)?:variableName.parent(OBJECT_DECLARATION)?.findChildByType(KDOC)?.kDocTags() |
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.
variableName.parent(CLASS)?:variableName.parent(OBJECT_DECLARATION)?.findChildByType(KDOC)?.kDocTags() | |
(variableName.parent(CLASS)?:variableName.parent(OBJECT_DECLARATION))?.findChildByType(KDOC)?.kDocTags() |
?
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.
elvis operator has the biggest priority, I guess...
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.
oh shit, fixed
### What's done: - diktat
…/Warnings.kt Co-authored-by: Peter Trifanov <peter.trifanov@mail.ru>
### What's done: - review notes
### What's done: - review notes
… bugfix/NPE-identifier-name
Codecov Report
@@ Coverage Diff @@
## master #1111 +/- ##
=========================================
Coverage 83.43% 83.43%
Complexity 2462 2462
=========================================
Files 102 102
Lines 6146 6146
Branches 1840 1840
=========================================
Hits 5128 5128
Misses 274 274
Partials 744 744
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Which rule and warnings did you add?
This pull request closes
Actions checklist
Fixme