patrickfav/dice

View on GitHub

Showing 42 of 60 total issues

Method render has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public long render(long count, PrintStream outStream, boolean toFile) {
        if (count != 0) {
            int currentCount = 0;
            int countPerIteration = RND_PER_REQUEST;

Severity: Minor
Found in src/main/java/at/favre/tools/dice/ui/ColumnRenderer.java - About 6 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 toString has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public String toString() {
            byte[] buf = new byte[46];
            t = -1343470464;
            buf[0] = (byte) (t >>> 1);
            t = 859390036;

    Method toString has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public String toString() {
                byte[] buf = new byte[34];
                t = -2039461835;
                buf[0] = (byte) (t >>> 17);
                t = -929408877;

      Method equals has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

              @Override
              public boolean equals(Object o) {
                  if (this == o) return true;
                  if (o == null || getClass() != o.getClass()) return false;
      
      

      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 render has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public long render(long count, PrintStream outStream, boolean toFile) {
              if (count != 0) {
                  int currentCount = 0;
                  int countPerIteration = RND_PER_REQUEST;
      
      
      Severity: Minor
      Found in src/main/java/at/favre/tools/dice/ui/ColumnRenderer.java - About 2 hrs to fix

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

                public final void run() {
                    try {
                        while (true) {
                            // Queue full? Wait till there's room.
                            synchronized (this) {

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

            public static Arg parse(String[] args) {
                Options options = setupOptions();
                CommandLineParser parser = new DefaultParser();
                Arg.Builder argument = Arg.builder();
        
        
        Severity: Minor
        Found in src/main/java/at/favre/tools/dice/ui/CLIParser.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 parse has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static Arg parse(String[] args) {
                Options options = setupOptions();
                CommandLineParser parser = new DefaultParser();
                Arg.Builder argument = Arg.builder();
        
        
        Severity: Minor
        Found in src/main/java/at/favre/tools/dice/ui/CLIParser.java - About 1 hr to fix

          Method execute has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static void execute(Arg arguments) throws AppException {
                  long start = System.currentTimeMillis();
          
                  EncoderHandler loader = new EncoderHandler();
                  loader.load();
          Severity: Minor
          Found in src/main/java/at/favre/tools/dice/RndTool.java - About 1 hr to fix

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

                @Override
                public Result<RandomOrgBlobResponse> getRandom() {
                    Instant startTime = Instant.now();
            
                    OkHttpClient client = createClient();

            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 getRandom has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public Result<RandomOrgBlobResponse> getRandom() {
                    Instant startTime = Instant.now();
            
                    OkHttpClient client = createClient();

              Method main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static void main(String args[]) {
                      System.out.println("- Downloader started");
                      File baseDirectory = new File(args[0]);
                      System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
              
              
              Severity: Minor
              Found in .mvn/wrapper/MavenWrapperDownloader.java - About 1 hr to fix

                Method run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public final void run() {
                            try {
                                while (true) {
                                    // Queue full? Wait till there's room.
                                    synchronized (this) {

                  Method create has 13 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static Arg create(PrintStream cmdLinePrintStream, String encoding, String seed, int length, Long count, boolean offline, boolean enableAnuQuantum, boolean urlencode, boolean debug, boolean padding, boolean robot, boolean crc32, File outFile) {
                  Severity: Major
                  Found in src/main/java/at/favre/tools/dice/ui/Arg.java - About 1 hr to fix

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

                            @Override
                            public boolean equals(Object o) {
                                if (this == o) return true;
                                if (o == null || getClass() != o.getClass()) return false;
                    
                    

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

                        public byte[] decode(String input) {
                            if (input.length() == 0) {
                                return new byte[0];
                            }
                            // Convert the base58-encoded ASCII chars to a base58 byte sequence (base58 digits).
                    Severity: Minor
                    Found in src/main/java/at/favre/tools/dice/encode/impl/Base58.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        static void execute(Arg arguments) throws AppException {
                            long start = System.currentTimeMillis();
                    
                            EncoderHandler loader = new EncoderHandler();
                            loader.load();
                    Severity: Minor
                    Found in src/main/java/at/favre/tools/dice/RndTool.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 main has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static void main(String args[]) {
                            System.out.println("- Downloader started");
                            File baseDirectory = new File(args[0]);
                            System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
                    
                    
                    Severity: Minor
                    Found in .mvn/wrapper/MavenWrapperDownloader.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 decode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public byte[] decode(String input) {
                            if (input.length() == 0) {
                                return new byte[0];
                            }
                            // Convert the base58-encoded ASCII chars to a base58 byte sequence (base58 digits).
                    Severity: Minor
                    Found in src/main/java/at/favre/tools/dice/encode/impl/Base58.java - About 1 hr to fix

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

                                  public void run() {
                                      while (buffer.remainingCapacity() > 0) {
                                          Counter counterRunnable = new Counter();
                                          new Thread(counterRunnable).start();
                      
                      

                      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