giedomak/Telepath

View on GitHub

Showing 60 of 60 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (println) {
            if(error) {
                System.err.println(padLeft(callerClassName, padding) + ": " + message)
            } else {
                println(padLeft(callerClassName, padding) + ": " + message)
src/main/java/com/github/giedomak/telepath/utilities/Logger.kt on lines 54..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 120.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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())

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (ctx.binaryOperator().UNION() != null) {
                    // UNION
                    result.operator = LogicalPlan.UNION
                } else if (ctx.binaryOperator().CONJUNCTION() != null) {
                    // CONCATENATION
    src/main/java/com/github/giedomak/telepath/staticparser/rpq/RPQVisitorParser.kt on lines 63..69

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (ctx.unaryOperator().PLUS() != null) {
                    // PLUS
                    result.operator = LogicalPlan.PLUS
                } else if (ctx.unaryOperator().KLEENE_STAR() != null) {
                    // KLEENE STAR
    src/main/java/com/github/giedomak/telepath/staticparser/rpq/RPQVisitorParser.kt on lines 81..87

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            pairsMap.compute(edgePair, { _, value -> value?.add(Pair(node1, node3)); value ?: HashSet(listOf(Pair(node1, node3))) })
    src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn1.kt on lines 34..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 113.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            pairsMap.compute(edge, { _, value -> value?.add(Pair(node1, node2)); value ?: HashSet(listOf(Pair(node1, node2))) })
    src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn2.kt on lines 41..41

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 113.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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
          
          

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                /**
                 * Insert method to insert a Path into the KPathIndex.
                 *
                 * @param path The path we will insert into the KPathIndex.
                 */
            src/main/java/com/github/giedomak/telepath/kpathindex/KPathIndexDisk.kt on lines 47..58

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                /**
                 * Insert method to insert a Path into the KPathIndex.
                 *
                 * @param path The path we will insert into the KPathIndex.
                 */
            src/main/java/com/github/giedomak/telepath/kpathindex/KPathIndexInMemory.kt on lines 45..56

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      val partition2 = StreamSupport.stream(
                              PartitioningYaySpliterator(lastChild.evaluate().paths.spliterator(), { it.nodes.first().id }), true
                      )
              src/main/java/com/github/giedomak/telepath/physicaloperators/SortMergeJoin.kt on lines 80..82

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 88.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      val partition1 = StreamSupport.stream(
                              PartitioningYaySpliterator(firstChild.evaluate().paths.spliterator(), { it.nodes.first().id }), true
                      )
              src/main/java/com/github/giedomak/telepath/physicaloperators/SortMergeJoin.kt on lines 84..86

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 88.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  /**
                   * Number of paths labeled l2 from nodes in middle to nodes in in.
                   */
                  fun two(edges: Pair<Edge, Edge>): Int {
                      if (initAfterMath) afterMath()
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Synopsis.kt on lines 91..97

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 87.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  /**
                   * Number of paths labeled l1 from nodes in out to nodes in middle.
                   */
                  fun one(edges: Pair<Edge, Edge>): Int {
                      if (initAfterMath) afterMath()
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Synopsis.kt on lines 99..105

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 87.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                      inMap.compute(edgePair, { _, value -> value?.add(node3); value ?: HashSet(listOf(node3)) })
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn1.kt on lines 28..28
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn2.kt on lines 35..35

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 83.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                      middleMap.compute(edgePair, { _, value -> value?.add(node2); value ?: HashSet(listOf(node2)) })
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn1.kt on lines 28..28
              src/main/java/com/github/giedomak/telepath/cardinalityestimation/synopsis/Syn2.kt on lines 32..32

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 83.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language