Swati4star/Images-to-PDF

View on GitHub
app/src/main/java/swati4star/createpdf/util/SplitPDFUtils.java

Summary

Maintainability
C
1 day
Test Coverage

Method checkRangeValidity has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public static int checkRangeValidity(int numOfPages, String[] ranges) {
        int startPage, endPage;
        int returnValue = NO_ERROR;

        if (ranges.length == 0)
Severity: Minor
Found in app/src/main/java/swati4star/createpdf/util/SplitPDFUtils.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 splitPDFByConfig has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public ArrayList<String> splitPDFByConfig(String path, String splitDetail) {
        String splitConfig = splitDetail.replaceAll("\\s+", "");
        ArrayList<String> outputPaths = new ArrayList<>();
        String delims = "[,]";
        String[] ranges = splitConfig.split(delims);
Severity: Minor
Found in app/src/main/java/swati4star/createpdf/util/SplitPDFUtils.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 splitPDFByConfig has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public ArrayList<String> splitPDFByConfig(String path, String splitDetail) {
        String splitConfig = splitDetail.replaceAll("\\s+", "");
        ArrayList<String> outputPaths = new ArrayList<>();
        String delims = "[,]";
        String[] ranges = splitConfig.split(delims);
Severity: Major
Found in app/src/main/java/swati4star/createpdf/util/SplitPDFUtils.java - About 2 hrs to fix

    Method checkRangeValidity has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static int checkRangeValidity(int numOfPages, String[] ranges) {
            int startPage, endPage;
            int returnValue = NO_ERROR;
    
            if (ranges.length == 0)
    Severity: Minor
    Found in app/src/main/java/swati4star/createpdf/util/SplitPDFUtils.java - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status