Method loadClassWithAnnotations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Wontfix
static Map<Class<? extends Annotation>, List<Class>> loadClassWithAnnotations(
String path, List<Class<? extends Annotation>> annotations, String startWith, ClassLoader classLoader) throws Throwable {
Map<Class<? extends Annotation>, List<Class>> result = new HashMap<>();
List<String> filteredClassNames = filter(getAllClasses(path), startWith);
for (String className : filteredClassNames) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
private static List<String> filter(List<String> names, String startWith) {
if (startWith == null || startWith.isEmpty()) {
return names;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method loadBeanWithType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
static <T> T loadBeanWithType(ClassLoader classLoader, String path, Class<T> beanType) throws Throwable {
JarFile jar = new JarFile(new File(path));
Enumeration entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"