-
Notifications
You must be signed in to change notification settings - Fork 0
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
optimize junit abstract class #133
Conversation
sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java
Fixed
Show fixed
Hide fixed
return checkAndMatchBinding(node, typeBinding); | ||
} | ||
|
||
@Override |
Check warning
Code scanning / PMD
Avoid unused method parameters such as 'holder'. Warning
ITypeBinding subtypeBinding= subtype.getAdapter(ITypeBinding.class); | ||
if (subtypeBinding != null) { | ||
subclasses.add(subtypeBinding); | ||
} |
Check warning
Code scanning / PMD
Avoid unused method parameters such as 'holder'. Warning
sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java
Fixed
Show fixed
Hide fixed
sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java
Fixed
Show fixed
Hide fixed
sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java
Fixed
Show fixed
Hide fixed
|
||
String fieldName = extractFieldName(fieldDeclaration); | ||
String nestedClassName = generateUniqueNestedClassName(anonymousClass, fieldName); | ||
TypeDeclaration nestedClass = createNestedClassFromAnonymous(anonymousClass, nestedClassName, fieldStatic, |
Check warning
Code scanning / PMD
Avoid unused local variables such as 'element'. Warning
} | ||
} | ||
} | ||
importRewriteToUse.addImport(ORG_JUNIT_JUPITER_API_EXTENSION_BEFORE_EACH_CALLBACK); |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid reassigning parameters such as 'typeBinding' Note
ListRewrite listRewrite= rewriter.getListRewrite(parentClass, TypeDeclaration.BODY_DECLARATIONS_PROPERTY); | ||
listRewrite.insertFirst(fieldDeclaration, group); | ||
} | ||
|
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid throwing raw exception types. Note
return input; | ||
} | ||
return Character.toUpperCase(input.charAt(0)) + input.substring(1); | ||
} |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid throwing raw exception types. Note
MethodDeclaration method= ast.newMethodDeclaration(); | ||
method.setName(ast.newSimpleName(methodName)); | ||
method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); | ||
method.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID)); |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid throwing raw exception types. Note
sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java
Fixed
Show fixed
Hide fixed
ITypeBinding binding = node.resolveBinding(); | ||
if (binding != null && ASTNodes.areBindingsEqual(binding, typeBinding)) { | ||
result[0] = (TypeDeclaration) node; | ||
return false; |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid unused local variables such as 'nestedClass'. Note
return checkAndMatchBinding(node, typeBinding); | ||
} | ||
|
||
@Override |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid unused method parameters such as 'fieldStatic'. Note
ITypeBinding subtypeBinding= subtype.getAdapter(ITypeBinding.class); | ||
if (subtypeBinding != null) { | ||
subclasses.add(subtypeBinding); | ||
} |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid unused method parameters such as 'group'. Note
// Verbinden mit der Datei, die der CompilationUnit entspricht | ||
bufferManager.connect(icu.getPath(), LocationKind.IFILE, null); | ||
|
||
// Holen des zugehörigen TextFileBuffer |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid reassigning parameters such as 'node' Note
if (getQualifiedName(typeDecl).equals(qualifiedTypeName)) { | ||
return typeDecl; | ||
String beforecallback; | ||
String aftercallback; |
Check notice
Code scanning / Pmd (reported by Codacy)
Avoid reassigning parameters such as 'node' Note
} | ||
|
||
private ASTNode findTypeDeclarationForBinding(ITypeBinding typeBinding, CompilationUnit cu) { | ||
if (typeBinding == null) return null; |
Check warning
Code scanning / PMD
This statement should have braces Warning
if (method.isConstructor()) { | ||
hasConstructor = true; | ||
if (method.parameters().isEmpty() && method.getBody() != null | ||
&& method.getBody().statements().isEmpty()) { |
Check warning
Code scanning / PMD
Position literals first in String comparisons Warning
} | ||
} | ||
return null; | ||
private boolean isSubtypeOf(ITypeBinding subtype, ITypeBinding supertype) { |
Check warning
Code scanning / PMD
Avoid unused private methods such as 'isSubtypeOf(ITypeBinding, ITypeBinding)'. Warning
No description provided.