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

optimize junit abstract class #133

Merged
merged 5 commits into from
Jan 6, 2025
Merged

optimize junit abstract class #133

merged 5 commits into from
Jan 6, 2025

Conversation

carstenartur
Copy link
Owner

No description provided.

return checkAndMatchBinding(node, typeBinding);
}

@Override

Check warning

Code scanning / PMD

Avoid unused method parameters such as 'holder'. Warning

Avoid unused method parameters such as 'fieldStatic'.
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

Avoid unused method parameters such as 'group'.

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

Avoid unused local variables such as 'nestedClass'.
}
}
}
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

Avoid reassigning parameters such as 'typeBinding'
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

Avoid throwing raw exception types.
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

Avoid throwing raw exception types.
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

Avoid throwing raw exception types.
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

Avoid unused local variables such as 'nestedClass'.
return checkAndMatchBinding(node, typeBinding);
}

@Override

Check notice

Code scanning / Pmd (reported by Codacy)

Avoid unused method parameters such as 'fieldStatic'. Note

Avoid unused method parameters such as 'fieldStatic'.
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

Avoid unused method parameters such as 'group'.
// 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

Avoid reassigning parameters such as 'node'
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

Avoid reassigning parameters such as 'node'
}

private ASTNode findTypeDeclarationForBinding(ITypeBinding typeBinding, CompilationUnit cu) {
if (typeBinding == null) return null;

Check warning

Code scanning / PMD

This statement should have braces Warning

This statement should have braces
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

Position literals first in String comparisons
}
}
return null;
private boolean isSubtypeOf(ITypeBinding subtype, ITypeBinding supertype) {

Check warning

Code scanning / PMD

Avoid unused private methods such as 'isSubtypeOf(ITypeBinding, ITypeBinding)'. Warning

Avoid unused private methods such as 'isSubtypeOf(ITypeBinding, ITypeBinding)'.

/**
* General method to extract a type's fully qualified name.
*/

Check notice

Code scanning / Pmd (reported by Codacy)

Avoid throwing raw exception types. Note

Avoid throwing raw exception types.
@carstenartur carstenartur merged commit 0c4d631 into main Jan 6, 2025
16 checks passed
@carstenartur carstenartur deleted the optimize branch January 6, 2025 19:11
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.

1 participant