zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java

Summary

Maintainability
D
2 days
Test Coverage

Stream has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Stream {

    private final Iterator<Object> iterator;

Severity: Minor
Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 5 hrs to fix

    File Stream.java has 380 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Licensed to the Apache Software Foundation (ASF) under one or more
     * contributor license agreements.  See the NOTICE file distributed with
     * this work for additional information regarding copyright ownership.
     * The ASF licenses this file to You under the Apache License, Version 2.0
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 5 hrs to fix

      Method compare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings({ "rawtypes", "unchecked" })
          private Optional compare(boolean isMax) {
              Comparable result = null;
      
              if (iterator.hasNext()) {
      Severity: Minor
      Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 2 hrs 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 flatMap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public Stream flatMap(final LambdaExpression le) {
              Iterator<Object> downStream = new OpIterator() {
      
                  private Iterator<?> inner;
      
      Severity: Minor
      Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 1 hr 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 compare has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings({ "rawtypes", "unchecked" })
          private Optional compare(boolean isMax) {
              Comparable result = null;
      
              if (iterator.hasNext()) {
      Severity: Minor
      Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 1 hr to fix

        Method compare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private Optional compare(boolean isMax, LambdaExpression le) {
                Object result = null;
        
                if (iterator.hasNext()) {
                    Object obj = iterator.next();
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 55 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 sorted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public Stream sorted(final LambdaExpression le) {
                Iterator<Object> downStream = new OpIterator() {
        
                    private Iterator<Object> sorted = null;
        
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.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 sorted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public Stream sorted() {
                Iterator<Object> downStream = new OpIterator() {
        
                    private Iterator<Object> sorted = null;
        
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.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 substream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public Stream substream(final Number start, final Number end) {
        
                Iterator<Object> downStream = new OpIterator() {
        
                    private final int startPos = start.intValue();
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 25 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

        There are no issues that match your filters.

        Category
        Status