funkygao/cp-ddd-framework

View on GitHub

Showing 146 of 168 total issues

Method analyze has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    public ReverseEngineeringModel analyze(FileWalker.Filter filter) {
        ReverseEngineeringModel model = new ReverseEngineeringModel();

        // all the packages
        List<CompilationUnit> compilationUnits = 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

File PlantUmlRenderer.java has 473 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright DDDplus Authors.
 *
 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */

    Method analyze has 154 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public ReverseEngineeringModel analyze(FileWalker.Filter filter) {
            ReverseEngineeringModel model = new ReverseEngineeringModel();
    
            // all the packages
            List<CompilationUnit> compilationUnits = new ArrayList<>();

      Method writeClazzDefinition has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          private PlainTextRenderer writeClazzDefinition(KeyModelEntry keyModelEntry) {
              append(keyModelEntry.getClassName());
              if (keyModelEntry.hasJavadoc()) {
                  append(SPACE).append(keyModelEntry.getJavadoc());
              }

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

          private PlantUmlRenderer writeClazzDefinition(KeyModelEntry keyModelEntry, boolean isAggregateRoot) {
              append("class ").append(keyModelEntry.getClassName());
              if (isAggregateRoot) {
                  if (keyModelEntry.hasJavadoc()) {
                      append(String.format(" <<(R,#FF7700) %s>> ", keyModelEntry.getJavadoc()));

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

          public Map<KeyElement.Type, KeyPropertyEntry> parse(AnnotationExpr keyElement) {
              List<KeyElement.Type> types = new ArrayList<>();
              KeyPropertyEntry entry = new KeyPropertyEntry();
              entry.setJavadoc(JavaParserUtil.javadocFirstLineOf(bodyDeclaration));
              if (fieldDeclaration != null) {

      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

      PlantUmlRenderer has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class PlantUmlRenderer implements IModelRenderer<PlantUmlRenderer> {
          /**
           * Direction to render the plantuml.
           */
          public enum Direction {

        Method export has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            synchronized void export() {
                // domains
                this.domains = new ArrayList<>(InternalIndexer.domainDefMap.size());
                domains.addAll(InternalIndexer.domainDefMap.values().stream().map(domainDef -> new Domain(domainDef.getCode(), domainDef.getName())).collect(Collectors.toList()));
        
        

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

            @Override
            public void visit(final MethodDeclaration methodDeclaration, final ClassMethodReport report) {
                super.visit(methodDeclaration, report);
        
                if (ignoredMethodNames.contains(methodDeclaration.getNameAsString())) {

        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

        File CallGraphConfig.java has 313 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * Copyright DDDplus Authors.
         *
         * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
         */

          Method writeClazzDefinition has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private PlantUmlRenderer writeClazzDefinition(KeyModelEntry keyModelEntry, boolean isAggregateRoot) {
                  append("class ").append(keyModelEntry.getClassName());
                  if (isAggregateRoot) {
                      if (keyModelEntry.hasJavadoc()) {
                          append(String.format(" <<(R,#FF7700) %s>> ", keyModelEntry.getJavadoc()));

            Method executeSteps has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private List<String> executeSteps(String activityCode, List<String> stepCodes, Stack<IRevokableDomainStep> executedSteps, Model model,
                                                  SchedulingTaskExecutor taskExecutor, Set<String> asyncStepCodes) throws RuntimeException {
                    if (asyncStepCodes == null || taskExecutor == null) {
                        // the sentry
                        asyncStepCodes = emptyAsyncSteps;

            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

            KeyModelEntry has 25 methods (exceeds 20 allowed). Consider refactoring.
            Open

            @Getter
            public class KeyModelEntry {
                private static final int propertiesPerLine = 5;
            
                private static final Set<String> EMPTY_SET = new HashSet();

              Method writeClazzDefinition has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private PlainTextRenderer writeClazzDefinition(KeyModelEntry keyModelEntry) {
                      append(keyModelEntry.getClassName());
                      if (keyModelEntry.hasJavadoc()) {
                          append(SPACE).append(keyModelEntry.getJavadoc());
                      }

                Method visit has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public void visit(final MethodDeclaration methodDeclaration, final ClassMethodReport report) {
                        super.visit(methodDeclaration, report);
                
                        if (ignoredMethodNames.contains(methodDeclaration.getNameAsString())) {

                  Method append has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private void append(KeyFlowEntry entry, KeyModelEntry keyModelEntry) {
                          if (entry.isAsync()) {
                              append(" {abstract} ");
                          }
                          if (entry.isPolymorphism()) {

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

                      public List<List<String>> cluster(List<double[]> vectors, List<String> labels, Map<String, double[]> vectorMap) {
                          // 随机初始化簇中心
                          List<double[]> centroids = new ArrayList<>();
                          for (int i = 0; i < numClusters; i++) {
                              centroids.add(vectors.get(random.nextInt(vectors.size())));

                  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 match has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public final boolean match(@NonNull IIdentity identity) {
                          Class<? extends BasePattern> patternClazz = this.getClass();
                          Class<? extends IIdentity> identityClazz = identity.getClass();
                          String cacheKey = patternClazz.getName() + ":" + identityClazz.getName(); // pure perf

                    Method enforce has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public void enforce() throws IOException {
                            List<CompilationUnit> compilationUnits = new ArrayList<>();
                            for (File dir : dirs) {
                                new FileWalker(new DomainModelAnalyzer.ActualFilter(null), (level, path, file) -> {
                                    compilationUnits.add(FileWalker.silentParse(file));

                    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