-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fixed Design and implementation code smells #966
Conversation
@@ -300,6 +300,7 @@ public String getErrorMessage(EndpointValidationResult result, Map.Entry<String, | |||
} | |||
} | |||
|
|||
|
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.
remove me
return (element instanceof PsiLiteralExpression || element instanceof PropertyValueImpl) && parentOfType == null; | ||
} | ||
|
||
|
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.
One empty line is good enough
|
||
return getAttributeReferences(attribute, value, context); | ||
} | ||
//IMPLEMENTATION SMELL OF IF STATEMENT |
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.
Not sure what you mean by this, please clarify or remove it
...-plugin/src/main/java/com/github/cameltooling/idea/runner/debugger/CamelDebuggerPatcher.java
Show resolved
Hide resolved
} else { | ||
writer = GradleFileWriter.GROOVY; | ||
} | ||
writer = targetBuildFileName.endsWith(".kts") ? GradleFileWriter.KOTLIN : GradleFileWriter.GROOVY; |
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.
ditto, please revert since it doesn't help much
...in/src/main/java/com/github/cameltooling/idea/runner/debugger/CamelForkedDebuggerThread.java
Outdated
Show resolved
Hide resolved
@@ -87,31 +87,13 @@ public String getBeanName(PsiClass clazz) { | |||
* @param project - Project reference to narrow the search inside. | |||
* @return the {@link PsiClass} matching the bean name and annotation. | |||
*/ | |||
|
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.
useless empty line, please revert
returnName = StringUtils.stripDoubleQuotes(componentAnnotation.getText()); | ||
} else { | ||
returnName = Introspector.decapitalize(clazz.getName()); | ||
} |
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.
ditto, it doesn't bring much so please revert
closing stale PR |
Extracted Methods:
Extracted the method getBeanName to improve readability and isolate the logic for obtaining bean names based on annotations. The method now uses more descriptive names and has a single responsibility.
Extracted the method getBeanNameForAnnotation to encapsulate the logic of retrieving bean names from annotations, promoting code reuse.
Renamed Methods and Variables:
Renamed the method getBeanName to getBeanNameForAnnotations to better reflect its purpose.
Renamed the variable str to choicesString in the getErrorMessage method for clarity.
Decomposed Conditional Statements:
Decomposed the conditional statements in the getBeanNameForAnnotations method to simplify the logic and make it more straightforward.
Simplified the conditional statement in the getErrorMessage method by introducing a boolean variable hasSuggestions.
Introduced Explaining Variables:
Introduced the variable choicesString in the getBeanNameForAnnotations and getErrorMessage methods to explain the purpose of the string representation of choices.
Removed Unused Code:
Removed unused imports and variables, ensuring a cleaner codebase.
Optimized Enumerations:
Leveraged Java 8 features to handle enumerations more concisely, improving code efficiency.