funkygao/cp-ddd-framework

View on GitHub

Showing 109 of 168 total issues

Method execute has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        getLog().info("Reverse modeling starting ...");
        try {
            String[] dirPaths = rootDir.split(":");

    ClassMethodDistributionAstNodeVisitor has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ClassMethodDistributionAstNodeVisitor extends VoidVisitorAdapter<ClassMethodReport> {
        private static Set<String> ignoredMethodNames = new HashSet<>();
        private static Set<Class> ignoredMethodAnnotation = new HashSet<>();
        private static Set<Class> ignoredClassAnnotation = new HashSet<>();
        static {

      Method parse has 58 lines of code (exceeds 25 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) {

        Method parse has a Cognitive Complexity of 17 (exceeds 5 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()) {

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

            @Override
            public void visit(final MethodDeclaration methodDeclaration, final KeyRuleReport report) {
                super.visit(methodDeclaration, report);
        
                if (!methodDeclaration.isAnnotationPresent(KeyRule.class)) {

        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 a Cognitive Complexity of 16 (exceeds 5 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

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

            public Set<Pair> displayRelations() {
                Set<Pair> result = new TreeSet<>();
                for (Pair self : relations) {
                    if (ignored(self)) {
                        continue;

        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 export has 44 lines of code (exceeds 25 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()));
        
        

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

              public KeyFlowEntry parse(AnnotationExpr keyFlow) {
                  KeyFlowEntry entry = new KeyFlowEntry(className, methodName,
                          JavaParserUtil.javadocFirstLineOf(methodDeclaration));
                  entry.setRealArguments(JavaParserUtil.extractMethodArguments(methodDeclaration));
          
          

            Method visit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public void visit(final FieldDeclaration fieldDeclaration, final KeyModelReport report) {
                    super.visit(fieldDeclaration, report);
            
                    ClassOrInterfaceDeclaration parentClass = JavaParserUtil.getClass(fieldDeclaration.getParentNode().get());

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

                @Override
                public void visit(final FieldDeclaration fieldDeclaration, final KeyModelReport report) {
                    super.visit(fieldDeclaration, report);
            
                    ClassOrInterfaceDeclaration parentClass = JavaParserUtil.getClass(fieldDeclaration.getParentNode().get());

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

                  private void writeClazzDefinition(AggregateEntry aggregateEntry, KeyModelEntry keyModelEntry) throws SQLException, ClassNotFoundException {
                      List<String> sqlList = new LinkedList<>();
                      for (KeyElement.Type type : keyModelEntry.types()) {
                          for (KeyPropertyEntry propertyEntry : keyModelEntry.keyPropertiesByType(type)) {
                              sqlList.add(String.format(EntityInsert,

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

                    @Override
                    public void visit(final MethodDeclaration methodDeclaration, final KeyRuleReport report) {
                        super.visit(methodDeclaration, report);
                
                        if (!methodDeclaration.isAnnotationPresent(KeyRule.class)) {

                  Method packageOfKeyRelationRightClass has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static String packageOfKeyRelationRightClass(AnnotationExpr keyRelation, ClassExpr rightClassExpr) {
                          CompilationUnit cu = null;
                          Node node = keyRelation.getParentNode().get();
                          for (; ; ) {
                              Optional<Node> parent = node.getParentNode();

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

                      private boolean skipMethod(MethodDeclaration methodDeclaration, ClassOrInterfaceDeclaration parentClass) {
                          if (methodDeclaration.isAnnotationPresent(AllowedAccessors.class)) {
                              // 指定类可访问的方法,忽略
                              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 cluster has 38 lines of code (exceeds 25 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())));

                    Method executeSteps has 37 lines of code (exceeds 25 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;

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

                          @Override
                          public void execute() throws MojoExecutionException, MojoFailureException {
                              getLog().info("Reverse modeling starting ...");
                              try {
                                  String[] dirPaths = rootDir.split(":");

                      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 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);
                      
                      
                        Severity
                        Category
                        Status
                        Source
                        Language