giedomak/Telepath

View on GitHub

Showing 19 of 60 total issues

Method generate has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
Open

    /**
     * Generate the cheapest physical plan for a given flattened logical plan.
     *
     * @param logicalPlan A flattened logical plan for which we have to generate the cheapest physical plan.
     * @return The cheapest physical plan for the given flattened logical plan.

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

    override fun evaluate(): PathStream {

//        val leftSorted = IteratorBuffer(firstChild.evaluate().paths.iterator())
//        val rightSorted = IteratorBuffer(lastChild.evaluate().paths.iterator())

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

    /**
     * Generate the cheapest physical plan for a given flattened logical plan.
     *
     * @param logicalPlan A flattened logical plan for which we have to generate the cheapest physical plan.
     * @return The cheapest physical plan for the given flattened logical plan.

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

    private fun printNodeInternal(nodes: List<AbstractMultiTree<*>?>, level: Int, maxLevel: Int) {
        if (nodes.isEmpty() || isAllElementsNull(nodes))
            return

        val floor = maxLevel - level

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

    private fun printNodeInternal(nodes: List<AbstractMultiTree<*>?>, level: Int, maxLevel: Int) {
        if (nodes.isEmpty() || isAllElementsNull(nodes))
            return

        val floor = maxLevel - level

    Method runQuery has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private fun runQuery(key: String, value: String, results: MutableList<Pair<String, String>>, first: Boolean): MutableList<Pair<String, String>> {
    
            // Record the timings
            val physicalPlanTimings = mutableListOf<Long>()
            val evaluationTimings = mutableListOf<Long>()
    Severity: Minor
    Found in src/main/java/com/github/giedomak/telepath/utilities/Benchmark.kt - About 1 hr to fix

      Method runCardinality has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private fun runCardinality(key: String, value: String) {
      
      
              // Retrieve input from the user until we retrieve 'END'
              val query = Query(Telepath, value)
      Severity: Minor
      Found in src/main/java/com/github/giedomak/telepath/utilities/Benchmark.kt - About 1 hr to fix

        Method evaluate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            override fun evaluate(): PathStream {
        
        //        val leftSorted = IteratorBuffer(firstChild.evaluate().paths.iterator())
        //        val rightSorted = IteratorBuffer(lastChild.evaluate().paths.iterator())
        
        

          Method generate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              /**
               * Generate the cheapest physical plan for a given flattened logical plan.
               *
               * @param logicalPlan A flattened logical plan for which we have to generate the cheapest physical plan.
               * @return The cheapest physical plan for the given flattened logical plan.

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

                /**
                 * Imports a LUBM file.
                 *
                 * Assumes the format of the file resembles: `<node_label> <http://edge_label> <node_label>` separated by space.
                 */

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

                  /**
                   * Generate the cheapest physical plan for a given flattened logical plan.
                   *
                   * @param logicalPlan A flattened logical plan for which we have to generate the cheapest physical plan.
                   * @return The cheapest physical plan for the given flattened logical plan.

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

                    fun run(kPathIndex: KPathIndex, k: Int, dryRun: Boolean = false): Long {
                
                        // Return if our kPathIndex is already of size k
                        if (kPathIndex.k >= k) return 0
                
                

                  Consider simplifying this complex logical expression.
                  Open

                                  if (name != Logger::class.java.name &&
                                          name.indexOf("java.lang.Thread") != 0 &&
                                          !name.contains("Lambda") &&
                                          !name.contains("ArrayList") &&
                                          !name.contains("ForEachOps") &&
                  Severity: Major
                  Found in src/main/java/com/github/giedomak/telepath/utilities/Logger.kt - About 1 hr to fix

                    Method getCardinality has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                    Open

                        /**
                         * Return the cardinality of a given physical plan.
                         */
                        override fun getCardinality(physicalPlan: PhysicalPlan): Long {
                    
                    

                    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

                    Avoid deeply nested control flow statements.
                    Open

                                            for (operator in LogicalPlan.OPERATORS) {
                    
                                                // Actually check for containment with the operator.
                                                if (logicalPlan.containsSubtreesThroughOperator(subtree1, subtree2, operator)) {
                    
                    

                      Avoid deeply nested control flow statements.
                      Open

                                              for (operator in LogicalPlan.OPERATORS) {
                      
                                                  // Actually check for containment with the operator.
                                                  if (logicalPlan.containsSubtreesThroughOperator(subtree1, subtree2, operator)) {
                      
                      

                        Avoid too many return statements within this method.
                        Open

                                return 0
                        Severity: Major
                        Found in src/main/java/com/github/giedomak/telepath/datamodels/graph/Path.kt - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return true

                            Avoid too many return statements within this method.
                            Open

                                    if (children != other.children) return false
                              Severity
                              Category
                              Status
                              Source
                              Language