funkygao/cp-ddd-framework

View on GitHub

Showing 146 of 168 total issues

Method builtinIgnoreInvokeInstruction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean builtinIgnoreInvokeInstruction(MethodVisitor m, InvokeInstruction instruction, CallGraphEntry callGraphEntry) {
        final String calleeMethod = callGraphEntry.getCalleeMethod();
        final String calleeClass = callGraphEntry.getCalleeClazz();
        if (ignore.ignoreClassInnerCall() && m.callerClass.equals(calleeClass)) {
            // 自己调用自己

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

    public KeyBehaviorEntry parse(AnnotationExpr keyBehavior) {
        KeyBehaviorEntry entry = new KeyBehaviorEntry(className, methodName);
        entry.setJavadoc(JavaParserUtil.javadocFirstLineOf(methodDeclaration));
        entry.setPackageName(packageName);

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

            @Override
            public void visit(final MethodCallExpr methodCallExpr, final Void __) {
                super.visit(methodCallExpr, __);
    
                if (parseMethodDeclaration) {

      Method append has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public AggregateEntry parse(AnnotationExpr aggregateAnnotationExpr) {
                AggregateEntry entry = new AggregateEntry();
                entry.setPackageName(packageDeclaration.getNameAsString());
                NormalAnnotationExpr expr = (NormalAnnotationExpr) aggregateAnnotationExpr;
                for (MemberValuePair memberValuePair : expr.getPairs()) {

          Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  void initialize() {
                      classPatterns = new ArrayList<>(classes.size());
                      for (String regex : classes) {
                          if (!regex.contains("*")) {
                              regex = "*" + regex;

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

              void start() {
                  if (config.ignoreCaller(this)) {
                      return;
                  }
          
          

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

              private R invokeExtension(ExtensionDef extensionDef, final Method method, Object[] args) throws Throwable {
                  try {
                      ExtensionContext context = null;
                      if (interceptor != null) {
                          context = new ExtensionContext(extensionDef.getCode(), extensionDef.getExtensionBean(), method, args);

            Method parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public KeyRelationEntry parse(AnnotationExpr keyRelation) {
                    KeyRelationEntry entry = new KeyRelationEntry();
                    entry.setJavadoc(JavaParserUtil.javadocFirstLineOf(leftClassDeclaration));
                    entry.setLeftClass(leftClassDeclaration.getNameAsString());
                    entry.setLeftClassPackageName(JavaParserUtil.packageName(leftClassDeclaration));

              Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      void initialize() {
                          classPatterns = new ArrayList<>(classes.size());
                          for (String regex : classes) {
                              if (!regex.contains("*")) {
                                  regex = "*" + regex;

                Method methodClusters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public List<List<String>> methodClusters() {
                        if (keyBehaviorEntries.size() < 6) {
                            // 太少,没必要聚类分析
                            return null;
                        }

                  Method calleeRecords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

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

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

                      public List<List<String>> methodClusters() {
                          if (keyBehaviorEntries.size() < 6) {
                              // 太少,没必要聚类分析
                              return 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

                  Method effectiveEntries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private List<CallGraphEntry> effectiveEntries() {
                          if (!config.ignoreOrphanNodes()) {
                              return entries;
                          }
                  
                  

                  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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                          @Override
                          public void visit(final MethodCallExpr methodCallExpr, final Void __) {
                              super.visit(methodCallExpr, __);
                  
                              if (parseMethodDeclaration) {

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

                      private boolean builtinIgnoreInvokeInstruction(MethodVisitor m, InvokeInstruction instruction, CallGraphEntry callGraphEntry) {
                          final String calleeMethod = callGraphEntry.getCalleeMethod();
                          final String calleeClass = callGraphEntry.getCalleeClazz();
                          if (ignore.ignoreClassInnerCall() && m.callerClass.equals(calleeClass)) {
                              // 自己调用自己

                    Method parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public KeyUsecaseEntry parse(AnnotationExpr keyUsecase) {
                            KeyUsecaseEntry entry = new KeyUsecaseEntry(className, methodName);
                            entry.setJavadoc(JavaParserUtil.javadocFirstLineOf(methodDeclaration));
                            if (keyUsecase instanceof MarkerAnnotationExpr) {
                                // 标注时没有指定任何属性

                      Method start has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          void start() {
                              if (config.ignoreCaller(this)) {
                                  return;
                              }
                      
                      

                        Method enforce has 26 lines of code (exceeds 25 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));

                          Method parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public KeyRuleEntry parse(AnnotationExpr keyRule) {
                                  KeyRuleEntry entry = new KeyRuleEntry();
                                  entry.setClassName(this.className);
                                  entry.setMethodName(this.methodName);
                                  entry.setRealMethodName(this.methodName);
                            Severity
                            Category
                            Status
                            Source
                            Language