makbn/fdt_streamfork

View on GitHub

Showing 6 of 6 total issues

Method run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void run() {
        FileState state = FileState.FILE_STATE_READ_NAME_LEN;
        try {
            InputStream is = client.getInputStream();
Severity: Minor
Found in src/main/java/io/github/makbn/streamfork/server/FileSession.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 run has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void run() {
        FileState state = FileState.FILE_STATE_READ_NAME_LEN;
        try {
            InputStream is = client.getInputStream();
Severity: Major
Found in src/main/java/io/github/makbn/streamfork/server/FileSession.java - About 2 hrs to fix

    Method handleSWP has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void handleSWP(StreamBlock block) throws IOException, InterruptedException {
            ExecutorService executorService = Executors.newFixedThreadPool(connections.size());
            ArrayList<OutputStream> oss = new ArrayList<>();
            ArrayList<Socket> stableSockets = new ArrayList<>();
            for (Socket socket : connections) {
    Severity: Minor
    Found in src/main/java/io/github/makbn/streamfork/client/SFClient.java - About 1 hr to fix

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

          private void checkForClose() throws IOException, InterruptedException {
              log.info("closing client:");
              if (mode == StreamMode.SERIAL) {
                  log.info("closing in serial mode");
                  for (Socket s : connections) {
      Severity: Minor
      Found in src/main/java/io/github/makbn/streamfork/client/SFClient.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

      Method handleSWP has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private void handleSWP(StreamBlock block) throws IOException, InterruptedException {
              ExecutorService executorService = Executors.newFixedThreadPool(connections.size());
              ArrayList<OutputStream> oss = new ArrayList<>();
              ArrayList<Socket> stableSockets = new ArrayList<>();
              for (Socket socket : connections) {
      Severity: Minor
      Found in src/main/java/io/github/makbn/streamfork/client/SFClient.java - About 35 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

      Method read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static byte[] read(InputStream inputStream, int size) {
              byte[] bytes = new byte[size];
              int readLength = 0;
              int remainingLength = size;
              int lastRead = 0;
      Severity: Minor
      Found in src/main/java/io/github/makbn/streamfork/stream/StreamReader.java - About 25 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

      Severity
      Category
      Status
      Source
      Language