funkygao/cp-ddd-framework

View on GitHub
dddplus-plugin/src/main/java/io/github/dddplus/runtime/registry/Plugin.java

Summary

Maintainability
A
0 mins
Test Coverage

Method preparePlugins has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Wontfix

    private void preparePlugins(Class<? extends Annotation> identityResolverAnnotation, Map<Class<? extends Annotation>, List<Class>> plugableMap) throws IllegalAccessException, InstantiationException {
        List<Class> identityResolverClasses = plugableMap.get(identityResolverAnnotation);
        if (identityResolverClasses != null && !identityResolverClasses.isEmpty()) {
            if (identityResolverAnnotation == Partner.class && identityResolverClasses.size() > 1) {
                throw new RuntimeException("One Partner jar can have at most 1 Partner instance!");

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 preparePlugins has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

    private void preparePlugins(Class<? extends Annotation> identityResolverAnnotation, Map<Class<? extends Annotation>, List<Class>> plugableMap) throws IllegalAccessException, InstantiationException {
        List<Class> identityResolverClasses = plugableMap.get(identityResolverAnnotation);
        if (identityResolverClasses != null && !identityResolverClasses.isEmpty()) {
            if (identityResolverAnnotation == Partner.class && identityResolverClasses.size() > 1) {
                throw new RuntimeException("One Partner jar can have at most 1 Partner instance!");

    There are no issues that match your filters.

    Category
    Status