Kuangcp/JavaBase

View on GitHub
algorithms/src/main/java/com/github/kuangcp/sort/Shell.java

Summary

Maintainability
B
5 hrs
Test Coverage

Method sort has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  public int[] sort(int[] data) {
    int[] arr = Arrays.copyOf(data, data.length);

    List<List<Integer>> dataList = new ArrayList<>();
    List<Integer> arrs = new ArrayList<>();
Severity: Minor
Found in algorithms/src/main/java/com/github/kuangcp/sort/Shell.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 sort has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public int[] sort(int[] data) {
    int[] arr = Arrays.copyOf(data, data.length);

    List<List<Integer>> dataList = new ArrayList<>();
    List<Integer> arrs = new ArrayList<>();
Severity: Minor
Found in algorithms/src/main/java/com/github/kuangcp/sort/Shell.java - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                if (temps.get(k) != null) {
                  dat.add(temps.get(k));
                }
    Severity: Major
    Found in algorithms/src/main/java/com/github/kuangcp/sort/Shell.java - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status