fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/Gradle.java

Summary

Maintainability
F
6 days
Test Coverage

File Gradle.java has 603 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.ext;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
Severity: Major
Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 day to fix

    Method extractGradleFiles has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        public void extractGradleFiles(String path, File file) {
            if (path == null || file == null) {
                return;
            }
            if (file.exists() == false) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 day 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 printGraph has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public static void printGraph(CharacterBuffer buffer, Object entry, Set<String> edges) {
            LinkedList<Object> q = new LinkedList<Object>();
            q.add(entry);
            HashSet<String> seen = new HashSet<String>();
            while (q.isEmpty() == false) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/Gradle.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 extractGradleFiles has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void extractGradleFiles(String path, File file) {
            if (path == null || file == null) {
                return;
            }
            if (file.exists() == false) {
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 3 hrs to fix

      Method initProject has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean initProject(String jarFile, String projectName, String licence) {
              if (Os.isReflectionTest() || jarFile == null || projectName == null) {
                  return false;
              }
              File file;
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/ext/Gradle.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 initProject has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean initProject(String jarFile, String projectName, String licence) {
              if (Os.isReflectionTest() || jarFile == null || projectName == null) {
                  return false;
              }
              File file;
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 2 hrs to fix

        Method writeGradle has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public boolean writeGradle(String path, String projectName, String licence) {
                if (Os.isReflectionTest() || path == null) {
                    return false;
                }
        
        
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 2 hrs to fix

          Method addAtrifact has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public CharacterBuffer addAtrifact(CharacterBuffer sb, String path, String projectName, String licence) {
                  if (sb == null) {
                      sb = new CharacterBuffer();
                  }
                  if (projectName == null) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/Gradle.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

          Gradle has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class Gradle implements ObjectCondition {
              private static final String GRADLE_PROPERTIES = "gradle-wrapper.properties";
              private boolean download = true;
              public static final String REFLECTIONTEST = "test";
              public static final String GIT = "git";
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 2 hrs to fix

            Method addAtrifact has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public CharacterBuffer addAtrifact(CharacterBuffer sb, String path, String projectName, String licence) {
                    if (sb == null) {
                        sb = new CharacterBuffer();
                    }
                    if (projectName == null) {
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 2 hrs to fix

              Method decompress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public boolean decompress(String file) {
                      if (Os.isReflectionTest()) {
                          return true;
                      }
                      if (file == null) {
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr 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 printGraph has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static void printGraph(CharacterBuffer buffer, Object entry, Set<String> edges) {
                      LinkedList<Object> q = new LinkedList<Object>();
                      q.add(entry);
                      HashSet<String> seen = new HashSet<String>();
                      while (q.isEmpty() == false) {
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

                Method writeProjectPath has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void writeProjectPath(String path, String name) {
                        if (Os.isReflectionTest() || path == null || name == null) {
                            return;
                        }
                        XMLContainer container = new XMLContainer().withStandardPrefix();
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

                  Method loadNPM has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public boolean loadNPM() {
                          if (Os.isReflectionTest()) {
                              return true;
                          }
                          JsonObject packageJson = new JsonObject();
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr 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 decompress has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public boolean decompress(String file) {
                          if (Os.isReflectionTest()) {
                              return true;
                          }
                          if (file == null) {
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

                    Method writeGradle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public boolean writeGradle(String path, String projectName, String licence) {
                            if (Os.isReflectionTest() || path == null) {
                                return false;
                            }
                    
                    
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr 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 execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public boolean execute(Object item, String... fileName) {
                            if (item == null) {
                                return false;
                            }
                            try {
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

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

                          public boolean loadNPM() {
                              if (Os.isReflectionTest()) {
                                  return true;
                              }
                              JsonObject packageJson = new JsonObject();
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

                        Method initTest has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public void initTest() {
                                CharacterBuffer buildGradle = FileBuffer.readFile(path + "build.gradle");
                                
                                buildGradle.withLine("apply plugin: 'jacoco'");
                                buildGradle.withLine("jacoco.toolVersion = \"0.8.+\"");
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 1 hr to fix

                          Method getLicenceText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static CharacterBuffer getLicenceText(XMLEntity entity, CharacterBuffer buffer, String projectName) {
                                  if (entity.sizeChildren() > 0) {
                                      for (int c = 0; c < entity.sizeChildren(); c++) {
                                          getLicenceText((XMLEntity) entity.getChild(c), buffer, projectName);
                                      }
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                                      while ((len = zis.read(buffer)) > 0) {
                                                          sb.with(buffer, 0, len);
                                                      }
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 45 mins to fix

                            Method execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public boolean execute(Object item, String... fileName) {
                                    if (item == null) {
                                        return false;
                                    }
                                    try {
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 45 mins 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

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (start > 0) {
                                                            int end = sb.indexOf('\n', start);
                                                            if (end > 0) {
                                                                String line = sb.substring(start, end);
                                                                if (line.indexOf("-snapshots") >= 0) {
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/ext/Gradle.java - About 45 mins to fix

                              TODO found
                              Open

                                      // TODO Auto-generated method stub

                              There are no issues that match your filters.

                              Category
                              Status