funkygao/cp-ddd-framework

View on GitHub

Showing 146 of 168 total issues

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

    public static ClassOrInterfaceDeclaration getClass(Node node) {
        while (!(node instanceof ClassOrInterfaceDeclaration)) {
            if (node.getParentNode().isPresent()) {
                node = node.getParentNode().get();
            } else {
dddplus-visualization/src/main/java/io/github/dddplus/ast/parser/JavaParserUtil.java on lines 87..98

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 50.

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.
Open

        for (KeyFlowEntry entry : keyModelEntry.getKeyFlowEntries()) {
            sqlList.add(String.format(EntityInsert,
                    aggregateEntry.getName(),
                    keyModelEntry.getClassName(),
                    EntityKind.FLOW.value,
dddplus-visualization/src/main/java/io/github/dddplus/ast/model/dumper/sqlite/SqliteDumper.java on lines 85..94

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 50.

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.
Open

                    case "byJavadoc":
                        if (entry.getJavadoc() == null || entry.getJavadoc().isEmpty()) {
                            log.warn("empty javadoc on {}", entry.toString());
                        } else {
                            entry.setName(entry.getJavadoc());
dddplus-visualization/src/main/java/io/github/dddplus/ast/parser/KeyElementAnnotationParser.java on lines 96..102

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 50.

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.
Open

                    case "remarkFromJavadoc":
                        if (entry.getJavadoc() == null || entry.getJavadoc().isEmpty()) {
                            log.warn("empty javadoc on {}", entry.toString());
                        } else {
                            entry.setRemark(entry.getJavadoc());
dddplus-visualization/src/main/java/io/github/dddplus/ast/parser/KeyElementAnnotationParser.java on lines 84..90

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 50.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    private String displayArgs() {
        if (useRawArgs) {
            return String.join(",", realArguments);
        }

dddplus-visualization/src/main/java/io/github/dddplus/ast/model/KeyBehaviorEntry.java on lines 41..51

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 49.

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.
Open

    public void registerImplementsRelation(String from, String fromJavadoc, List<String> genericTypes, String to) {
        Pair pair = new Pair(this, from, to, Pair.Relation.Implements, fromJavadoc, genericTypes);
        if (!ignored(pair)) {
            relations.add(pair);
        }
dddplus-visualization/src/main/java/io/github/dddplus/ast/report/ClassHierarchyReport.java on lines 19..24

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 49.

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.
Open

    public void registerExtendsRelation(String from, String fromJavadoc, List<String> genericTypes, String to) {
        Pair pair = new Pair(this, from, to, Pair.Relation.Extends, fromJavadoc, genericTypes);
        if (!ignored(pair)) {
            relations.add(pair);
        }
dddplus-visualization/src/main/java/io/github/dddplus/ast/report/ClassHierarchyReport.java on lines 30..35

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 49.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public String displayArgs() {
        if (useRawArgs) {
            return String.join(",", realArguments);
        }

dddplus-visualization/src/main/java/io/github/dddplus/ast/model/KeyFlowEntry.java on lines 104..114

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 49.

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

Method loadPartnerPlugin has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public synchronized void loadPartnerPlugin(@NonNull String code, @NonNull String version, @NonNull String jarPath, boolean useSpring, IContainerContext containerContext) throws Throwable {

    Method execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public final void execute(String activityCode, List<String> stepCodes, Model model,
                                  SchedulingTaskExecutor taskExecutor, Set<String> asyncStepCodes) throws RuntimeException {

      Method findExtension has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private <Ext extends IDomainExtension, R> Ext findExtension(@NonNull Class<Ext> extClazz, @NonNull Identity identity, IReducer<R> reducer, Ext defaultExt, int timeoutInMs) {
      Severity: Minor
      Found in dddplus-runtime/src/main/java/io/github/dddplus/runtime/BaseRouter.java - About 35 mins to fix

        Method specifiedGenericTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private List<String> specifiedGenericTypes(ClassOrInterfaceType parentClazz) {
                List<String> result = new ArrayList<>();
                NodeList<Type> genericTypes = parentClazz.getTypeArguments().orElse(null);
                if (genericTypes != null && genericTypes.isNonEmpty()) {
                    for (Type type : genericTypes) {

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

            boolean ignoreCaller(MethodVisitor m) {
                if (builtinIgnoreCaller(m)) {
                    return true;
                }
        
        

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

            private Collection<Record> callerRecords() {
                List<Record> records = new ArrayList<>();
                Set<String> callerClasses = new TreeSet<>();
                for (CallGraphEntry entry : entries) {
                    callerClasses.add(entry.getCallerClazz());

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

            private PlantUmlRenderer writeKeyUsecaseClazzDefinition(String actor) {
                append("class ").append(actor);
                String actorJavadoc = model.getKeyUsecaseReport().actorJavadoc(actor);
                if (actorJavadoc != null && !actorJavadoc.isEmpty()) {
                    append(String.format(" <<(C,#9197DB) %s>> ", actorJavadoc));

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

            @Deprecated
            static <R> IReducer<R> allOf(Predicate<R> predicate) {
                return new IReducer<R>() {
                    @Override
                    public R reduce(List<R> accumulatedResults) {
        Severity: Minor
        Found in dddplus-runtime/src/main/java/io/github/dddplus/runtime/IReducer.java - About 35 mins to fix

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

            private void walkFrom(int level, String path, File file) {
                if (file.isDirectory()) {
                    for (File child : file.listFiles()) {
                        walkFrom(level + 1, path + "/" + child.getName(), child);
                    }

        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

        Severity
        Category
        Status
        Source
        Language