funkygao/cp-ddd-framework

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

Summary

Maintainability
B
5 hrs
Test Coverage

Method findEffectiveExtensions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    @NonNull
    public static List<ExtensionDef> findEffectiveExtensions(@NonNull Class<? extends IDomainExtension> extClazz, @NonNull IIdentity identity, boolean firstStop) {
        List<ExtensionDef> effectiveExtensions = new LinkedList<>();

        // O(1) extension locating by Policy

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

    @NonNull
    public static List<ExtensionDef> findEffectiveExtensions(@NonNull Class<? extends IDomainExtension> extClazz, @NonNull IIdentity identity, boolean firstStop) {
        List<ExtensionDef> effectiveExtensions = new LinkedList<>();

        // O(1) extension locating by Policy

    Method postIndexing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        static void postIndexing() {
            for (PatternDef patternDef : patternDefMap.values()) {
                for (Class<? extends IDomainExtension> extClazz : patternDef.extClazzSet()) {
                    if (!sortedPatternMap.containsKey(extClazz)) {
                        sortedPatternMap.put(extClazz, new ArrayList<>());

    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 findDomainSteps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Wontfix

        @NonNull
        public static List<StepDef> findDomainSteps(@NonNull String activityCode, @NonNull List<String> stepCodeList) {
            Map<String, StepDef> childMap = domainStepDefMap.get(activityCode);
            if (childMap == null || childMap.isEmpty()) {
                log.error("found NO activity:{}", activityCode);

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Wontfix

        static void index(PatternDef patternDef) {
            if (patternDefMap.containsKey(patternDef.getCode())) {
                throw BootstrapException.ofMessage("duplicated pattern code: ", patternDef.getCode());
            }
    
    
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 308..319

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 76.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Wontfix

        static void index(PartnerDef partnerDef) {
            if (partnerDefMap.containsKey(partnerDef.getCode())) {
                throw BootstrapException.ofMessage("duplicated partner code: ", partnerDef.getCode());
            }
    
    
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 294..306

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 76.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            if (partnerDefMap.containsKey(extensionDef.getCode())) {
                // 基于垂直业务的扩展点
                PartnerDef partnerDef = partnerDefMap.get(extensionDef.getCode());
                partnerDef.registerExtensionDef(extensionDef);
    
    
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 261..268
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 270..277

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            if (patternDefMap.containsKey(extensionDef.getCode())) {
                // 基于Pattern的扩展点,因为在pattern里找到了对应的code:extension.code = pattern.code
                PatternDef patternDef = patternDefMap.get(extensionDef.getCode());
                patternDef.registerExtensionDef(extensionDef);
    
    
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 261..268
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 279..286

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            if (policyDefMap.containsKey(extensionDef.getExtClazz())) {
                // this extension clazz will use policy
                PolicyDef policyDef = policyDefMap.get(extensionDef.getExtClazz());
                policyDef.registerExtensionDef(extensionDef);
    
    
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 270..277
    dddplus-runtime/src/main/java/io/github/dddplus/runtime/registry/InternalIndexer.java on lines 279..286

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status