Showing 294 of 294 total issues

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

  public static int[] selectLast(
      char[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
    int[] results = new int[k];
    if (k > 0) {
      int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
Severity: Major
Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 4 hrs to fix
src/main/java/com/trickl/selection/Selection.java on lines 75..107
src/main/java/com/trickl/selection/Selection.java on lines 118..150
src/main/java/com/trickl/selection/Selection.java on lines 161..193
src/main/java/com/trickl/selection/Selection.java on lines 204..236

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 269.

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 5 locations. Consider refactoring.
Open

  public static int[] selectLast(
      int[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
    int[] results = new int[k];
    if (k > 0) {
      int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
Severity: Major
Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 4 hrs to fix
src/main/java/com/trickl/selection/Selection.java on lines 32..64
src/main/java/com/trickl/selection/Selection.java on lines 75..107
src/main/java/com/trickl/selection/Selection.java on lines 161..193
src/main/java/com/trickl/selection/Selection.java on lines 204..236

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 269.

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 5 locations. Consider refactoring.
Open

  public static int[] selectLast(
      float[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
    int[] results = new int[k];
    if (k > 0) {
      int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
Severity: Major
Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 4 hrs to fix
src/main/java/com/trickl/selection/Selection.java on lines 32..64
src/main/java/com/trickl/selection/Selection.java on lines 75..107
src/main/java/com/trickl/selection/Selection.java on lines 118..150
src/main/java/com/trickl/selection/Selection.java on lines 161..193

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 269.

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 5 locations. Consider refactoring.
Open

  public static int[] selectLast(
      short[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
    int[] results = new int[k];
    if (k > 0) {
      int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
Severity: Major
Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 4 hrs to fix
src/main/java/com/trickl/selection/Selection.java on lines 32..64
src/main/java/com/trickl/selection/Selection.java on lines 118..150
src/main/java/com/trickl/selection/Selection.java on lines 161..193
src/main/java/com/trickl/selection/Selection.java on lines 204..236

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 269.

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

File Selection.java has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.trickl.selection;

import com.trickl.sort.NaturalOrderingComparator;
import java.lang.reflect.Array;
import java.util.Collection;
Severity: Minor
Found in src/main/java/com/trickl/selection/Selection.java - About 4 hrs to fix

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

      public static <T> int[] selectFirst(
          double[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
        int[] results = new int[k];
        if (k > 0) {
          if (k == 1) {
    Severity: Major
    Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 3 hrs to fix
    src/main/java/com/trickl/selection/Selection.java on lines 268..299
    src/main/java/com/trickl/selection/Selection.java on lines 311..342
    src/main/java/com/trickl/selection/Selection.java on lines 397..428
    src/main/java/com/trickl/selection/Selection.java on lines 440..471

    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 237.

    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 5 locations. Consider refactoring.
    Open

      public static <T> int[] selectFirst(
          float[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
        int[] results = new int[k];
        if (k > 0) {
          if (k == 1) {
    Severity: Major
    Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 3 hrs to fix
    src/main/java/com/trickl/selection/Selection.java on lines 268..299
    src/main/java/com/trickl/selection/Selection.java on lines 311..342
    src/main/java/com/trickl/selection/Selection.java on lines 354..385
    src/main/java/com/trickl/selection/Selection.java on lines 440..471

    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 237.

    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 5 locations. Consider refactoring.
    Open

      public static <T> int[] selectFirst(
          int[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
        int[] results = new int[k];
        if (k > 0) {
          if (k == 1) {
    Severity: Major
    Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 3 hrs to fix
    src/main/java/com/trickl/selection/Selection.java on lines 268..299
    src/main/java/com/trickl/selection/Selection.java on lines 311..342
    src/main/java/com/trickl/selection/Selection.java on lines 354..385
    src/main/java/com/trickl/selection/Selection.java on lines 397..428

    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 237.

    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 5 locations. Consider refactoring.
    Open

      public static <T> int[] selectFirst(
          short[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
        int[] results = new int[k];
        if (k > 0) {
          if (k == 1) {
    Severity: Major
    Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 3 hrs to fix
    src/main/java/com/trickl/selection/Selection.java on lines 268..299
    src/main/java/com/trickl/selection/Selection.java on lines 354..385
    src/main/java/com/trickl/selection/Selection.java on lines 397..428
    src/main/java/com/trickl/selection/Selection.java on lines 440..471

    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 237.

    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 5 locations. Consider refactoring.
    Open

      public static <T> int[] selectFirst(
          char[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
        int[] results = new int[k];
        if (k > 0) {
          if (k == 1) {
    Severity: Major
    Found in src/main/java/com/trickl/selection/Selection.java and 4 other locations - About 3 hrs to fix
    src/main/java/com/trickl/selection/Selection.java on lines 311..342
    src/main/java/com/trickl/selection/Selection.java on lines 354..385
    src/main/java/com/trickl/selection/Selection.java on lines 397..428
    src/main/java/com/trickl/selection/Selection.java on lines 440..471

    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 237.

    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

    IntArrayPermutator has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class IntArrayPermutator implements Permutator {
    
      private int[] array;
    
      /**
    Severity: Minor
    Found in src/main/java/com/trickl/math/IntArrayPermutator.java - About 3 hrs to fix

      Permutator has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public interface Permutator {
      
        /**
         * Perform a three cycle permutation.
         * [ 1, 2, 3 ] -&gt; [ 2, 3, 1 ]
      Severity: Minor
      Found in src/main/java/com/trickl/math/Permutator.java - About 3 hrs to fix

        StandardPermutator has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class StandardPermutator implements Permutator {
        
          /**
           * {@inheritDoc}
           *
        Severity: Minor
        Found in src/main/java/com/trickl/math/StandardPermutator.java - About 3 hrs to fix

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

            protected int select(float[] S, int[] freq, int[] index, int start, int end, int k) {
          
              if (end == (start + 1)) {
                return start;
              } else {
          Severity: Major
          Found in src/main/java/com/trickl/selection/MedianOfMedians.java and 4 other locations - About 3 hrs to fix
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 58..79
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 109..130
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 160..181
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 262..283

          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 217.

          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 5 locations. Consider refactoring.
          Open

            protected int select(int[] S, int[] freq, int[] index, int start, int end, int k) {
          
              if (end == (start + 1)) {
                return start;
              } else {
          Severity: Major
          Found in src/main/java/com/trickl/selection/MedianOfMedians.java and 4 other locations - About 3 hrs to fix
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 58..79
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 109..130
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 160..181
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 211..232

          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 217.

          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 5 locations. Consider refactoring.
          Open

            protected int select(char[] S, int[] freq, int[] index, int start, int end, int k) {
          
              if (end == (start + 1)) {
                return start;
              } else {
          Severity: Major
          Found in src/main/java/com/trickl/selection/MedianOfMedians.java and 4 other locations - About 3 hrs to fix
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 109..130
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 160..181
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 211..232
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 262..283

          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 217.

          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 5 locations. Consider refactoring.
          Open

            protected int select(short[] S, int[] freq, int[] index, int start, int end, int k) {
          
              if (end == (start + 1)) {
                return start;
              } else {
          Severity: Major
          Found in src/main/java/com/trickl/selection/MedianOfMedians.java and 4 other locations - About 3 hrs to fix
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 58..79
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 160..181
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 211..232
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 262..283

          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 217.

          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 5 locations. Consider refactoring.
          Open

            protected int select(double[] S, int[] freq, int[] index, int start, int end, int k) {
          
              if (end == (start + 1)) {
                return start;
              } else {
          Severity: Major
          Found in src/main/java/com/trickl/selection/MedianOfMedians.java and 4 other locations - About 3 hrs to fix
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 58..79
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 109..130
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 211..232
          src/main/java/com/trickl/selection/MedianOfMedians.java on lines 262..283

          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 217.

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

            public static int[] selectLast(
                float[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
              int[] results = new int[k];
              if (k > 0) {
                int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
          Severity: Minor
          Found in src/main/java/com/trickl/selection/Selection.java - About 3 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 selectLast has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            public static int[] selectLast(
                int[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) {
              int[] results = new int[k];
              if (k > 0) {
                int size = freq == null ? S.length : accumulate(freq, 0, freq.length);
          Severity: Minor
          Found in src/main/java/com/trickl/selection/Selection.java - About 3 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

          Severity
          Category
          Status
          Source
          Language