patrickfav/dice

View on GitHub

Showing 60 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) {

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      private static final byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D, 0x60,
                              (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB, 0x52, (byte) 0xBF,
                              (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
                  src/main/java/at/favre/tools/dice/rnd/entropy/NonceEntropySource.java on lines 34..36

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 108.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      private static final byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D,
                              0x60, (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB,
                              0x52, (byte) 0xBF, (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
                  src/main/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySource.java on lines 30..32

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 108.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        private static final byte[] SALT = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3,
                                0x04, 0x16, 0x1F, (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A,
                                0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
                    src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java on lines 53..54
                    src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java on lines 55..56

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 100.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        private static final byte[] STATIC_RANDOM = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F,
                                (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
                    src/main/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPool.java on lines 35..37
                    src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java on lines 55..56

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 100.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language