Skip to content

Commit

Permalink
Remove isValid as that was always false
Browse files Browse the repository at this point in the history
  • Loading branch information
atulgpt committed May 20, 2023
1 parent b6ca359 commit 42b580c
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,13 @@ class SerialVersionUIDInSerializableClass(config: Config = Config.empty) : Rule(
}

private fun reportFinding(finding: SerialVersionUIDFindings) {
if (finding.isValid.not()) {
report(
CodeSmell(
issue,
Entity.atName(finding.violatingElement),
finding.issueMsg
)
report(
CodeSmell(
issue,
Entity.atName(finding.violatingElement),
finding.issueMsg
)
}
)
}

private fun isImplementingSerializable(classOrObject: KtClassOrObject) =
Expand All @@ -102,7 +100,6 @@ class SerialVersionUIDInSerializableClass(config: Config = Config.empty) : Rule(
): SerialVersionUIDFindings? {
val property = declaration.body?.properties?.firstOrNull { it.name == "serialVersionUID" }
?: return SerialVersionUIDFindings(
false,
parentDeclaration,
parentDeclaration.getIssueMessage(
if (parentDeclaration is KtClass) "class" else "object"
Expand All @@ -112,7 +109,6 @@ class SerialVersionUIDInSerializableClass(config: Config = Config.empty) : Rule(
null
} else {
SerialVersionUIDFindings(
false,
property,
"The property `serialVersionUID` signature is not correct. `serialVersionUID` should be " +
"`private` and `constant` and its type should be `Long`"
Expand All @@ -137,7 +133,6 @@ class SerialVersionUIDInSerializableClass(config: Config = Config.empty) : Rule(
}

private data class SerialVersionUIDFindings(
val isValid: Boolean,
val violatingElement: KtNamedDeclaration,
val issueMsg: String,
)
Expand Down

0 comments on commit 42b580c

Please sign in to comment.