ruboto/ruboto

View on GitHub
assets/app/src/main/java/org/jruby/util/Dir.java

Summary

Maintainability
F
2 wks
Test Coverage

Method glob_helper has a Cognitive Complexity of 177 (exceeds 5 allowed). Consider refactoring.
Open

    private static int glob_helper(Ruby runtime, String cwd,
        byte[] path, int begin, int end, Encoding enc, int sub,
        int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
        int status = 0;

Severity: Minor
Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 3 days 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

File Dir.java has 745 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/***** BEGIN LICENSE BLOCK *****
 * Version: EPL 2.0/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Eclipse Public
 * License Version 2.0 (the "License"); you may not use this file
Severity: Major
Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 day to fix

    Method helper has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

            int helper(byte[] pbytes, int pend, byte[] sbytes, int send, Encoding enc) {
                int s = scur;
                int p = pcur;
    
                int ptmp = -1;
    Severity: Minor
    Found in assets/app/src/main/java/org/jruby/util/Dir.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 bracket has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

            public int bracket(byte[] pbytes, int p, int pend, byte[] sbytes, int s, int send, Encoding enc) {
                boolean not = false;
                boolean ok = false;
                int r;
                int c1, c2;
    Severity: Minor
    Found in assets/app/src/main/java/org/jruby/util/Dir.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 braces has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

        public static ArrayList<String> braces(String pattern, int flags, ArrayList<String> patterns) {
            boolean escape = (flags & FNM_NOESCAPE) == 0;
    
            int rbrace = -1;
            int lbrace = -1;
    Severity: Minor
    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 7 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 fnmatch has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public static int fnmatch(
                byte[] bytes, int pstart, int pend,
                byte[] string, int sstart, int send, int flags, Encoding enc) {
    
            // This method handles '**/' patterns and delegates to
    Severity: Minor
    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 5 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 push_braces has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        private static int push_braces(Ruby runtime, String cwd, List<ByteList> result, GlobPattern pattern, boolean sort) {
            pattern.reset();
            int lbrace = pattern.indexOf((byte) '{'); // index of left-most brace
            int rbrace = pattern.findClosingIndexOf(lbrace);// index of right-most brace
    
    
    Severity: Minor
    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 5 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 glob_helper has 135 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static int glob_helper(Ruby runtime, String cwd,
            byte[] path, int begin, int end, Encoding enc, int sub,
            int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
            int status = 0;
    
    
    Severity: Major
    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 5 hrs to fix

      Method helper has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              int helper(byte[] pbytes, int pend, byte[] sbytes, int send, Encoding enc) {
                  int s = scur;
                  int p = pcur;
      
                  int ptmp = -1;
      Severity: Major
      Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 3 hrs to fix

        Dir has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class Dir {
            public final static boolean DOSISH = Platform.IS_WINDOWS;
            public final static boolean CASEFOLD_FILESYSTEM = DOSISH;
        
            public final static int FNM_NOESCAPE = 0x01;
        Severity: Minor
        Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 3 hrs to fix

          Method addToResultIfExists has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              private static int addToResultIfExists(Ruby runtime, String cwd, byte[] bytes, int begin, int end, Encoding enc, int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
                  final String fileName = new String(bytes, begin, end - begin, enc.getCharset());
          
                  // FIXME: Ultimately JRubyFile.createResource should do this but all 1.7.x is only selectively honoring raw
                  // paths and using system drive make it absolute.  MRI does this on many methods we don't.
          Severity: Minor
          Found in assets/app/src/main/java/org/jruby/util/Dir.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 bracket has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public int bracket(byte[] pbytes, int p, int pend, byte[] sbytes, int s, int send, Encoding enc) {
                      boolean not = false;
                      boolean ok = false;
                      int r;
                      int c1, c2;
          Severity: Major
          Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 2 hrs to fix

            Method braces has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static ArrayList<String> braces(String pattern, int flags, ArrayList<String> patterns) {
                    boolean escape = (flags & FNM_NOESCAPE) == 0;
            
                    int rbrace = -1;
                    int lbrace = -1;
            Severity: Major
            Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (lbrace == -1 || rbrace == -1 ||
                              lbrace > 0 && pattern.bytes[lbrace-1] == '\\' && (lbrace <= 1 || pattern.bytes[lbrace-2] != '\\') ||
                              rbrace > 0 && pattern.bytes[rbrace-1] == '\\' && (rbrace <= 1 || pattern.bytes[rbrace-2] != '\\')) {
                          ByteList unescaped = new ByteList(pattern.bytes.length - 1);
                          unescaped.setEncoding(pattern.enc);
              Severity: Critical
              Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 2 hrs to fix

                Method fnmatch has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static int fnmatch(
                            byte[] bytes, int pstart, int pend,
                            byte[] string, int sstart, int send, int flags, Encoding enc) {
                
                        // This method handles '**/' patterns and delegates to
                Severity: Minor
                Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

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

                      private static int push_braces(Ruby runtime, String cwd, List<ByteList> result, GlobPattern pattern, boolean sort) {
                          pattern.reset();
                          int lbrace = pattern.indexOf((byte) '{'); // index of left-most brace
                          int rbrace = pattern.findClosingIndexOf(lbrace);// index of right-most brace
                  
                  
                  Severity: Minor
                  Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

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

                        private static boolean has_magic(byte[] bytes, int begin, int end, int flags) {
                            boolean escape = (flags & FNM_NOESCAPE) == 0;
                            boolean nocase = (flags & FNM_CASEFOLD) != 0;
                            int open = 0;
                    
                    
                    Severity: Minor
                    Found in assets/app/src/main/java/org/jruby/util/Dir.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 glob_helper has 10 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private static int glob_helper(Ruby runtime, String cwd,
                            byte[] path, int begin, int end, Encoding enc, int sub,
                            int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
                    Severity: Major
                    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

                      Method addToResultIfExists has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private static int addToResultIfExists(Ruby runtime, String cwd, byte[] bytes, int begin, int end, Encoding enc, int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
                      Severity: Major
                      Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

                        Method addToResultIfExists has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static int addToResultIfExists(Ruby runtime, String cwd, byte[] bytes, int begin, int end, Encoding enc, int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
                                final String fileName = new String(bytes, begin, end - begin, enc.getCharset());
                        
                                // FIXME: Ultimately JRubyFile.createResource should do this but all 1.7.x is only selectively honoring raw
                                // paths and using system drive make it absolute.  MRI does this on many methods we don't.
                        Severity: Minor
                        Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

                          Method fnmatch has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                      byte[] bytes, int pstart, int pend,
                                      byte[] string, int sstart, int send, int flags, Encoding enc) {
                          Severity: Major
                          Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 1 hr to fix

                            Method glob_helper has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                private static int glob_helper(Ruby runtime, String cwd, ByteList path, int sub, int flags, GlobFunc<GlobArgs> func, GlobArgs arg) {
                            Severity: Major
                            Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 50 mins to fix

                              Method bracket has 7 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      public int bracket(byte[] pbytes, int p, int pend, byte[] sbytes, int s, int send, Encoding enc) {
                              Severity: Major
                              Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 50 mins to fix

                                Method fnmatch has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                            byte[] bytes, int pstart, int pend,
                                            byte[] string, int sstart, int send, int flags) {
                                Severity: Major
                                Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 50 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if(pos == rbrace) {
                                                              break;
                                                          }
                                  Severity: Major
                                  Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                if ( fnmatch(STAR, 0, 1, fileBytes, 0, fileBytes.length, flags) != 0) {
                                                                    continue;
                                                                }
                                    Severity: Major
                                    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

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

                                              public int findClosingIndexOf(int leftTokenIndex) {
                                                  if (leftTokenIndex == -1 || leftTokenIndex > end) return -1;
                                      
                                                  byte leftToken = bytes[leftTokenIndex];
                                                  byte rightToken;
                                      Severity: Minor
                                      Found in assets/app/src/main/java/org/jruby/util/Dir.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 ( status != 0 ) break finalize;
                                      Severity: Major
                                      Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                    if (length == 1) {
                                                                        if (recursive && (flags & FNM_DOTMATCH) == 0) continue;
                                                                        if (skipdot) continue;
                                                                    } else if (length == 2 && file.charAt(1) == '.') {
                                                                        continue;
                                        Severity: Major
                                        Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if ( status == 0 ) {
                                                                      resource = JRubyFile.createResource(runtime, cwd, RubyString.byteListToString(link));
                                                                      if ( resource.isDirectory() ) {
                                                                          final int len = link.getRealSize();
                                                                          buf.length(0);
                                          Severity: Major
                                          Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                        if(Arrays.equals(magic, DOUBLE_STAR)) {
                                                                            remainingPathStartIndex = nextStartIndex;
                                                                        } else {
                                                                            remainingPathStartIndex = nextStartIndex - 1;
                                                                        }
                                            Severity: Major
                                            Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                          if ( !resource.isSymLink() && resource.isDirectory() && !".".equals(file) && !"..".equals(file) ) {
                                                                              final int len = buf.getRealSize();
                                                                              buf.append(SLASH);
                                                                              buf.append(DOUBLE_STAR);
                                                                              buf.append(path, SLASH_INDEX, end - SLASH_INDEX);
                                              Severity: Major
                                              Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                                Method push_globs has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    private static int push_globs(Ruby runtime, String cwd, List<ByteList> ary, ByteList pattern, int flags, boolean sort) {
                                                Severity: Minor
                                                Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                              if ( SLASH_INDEX == -1 ) {
                                                                                  status = func.call(buf.getUnsafeBytes(), 0, buf.getRealSize(), enc, arg);
                                                                                  if ( status != 0 ) break;
                                                                                  continue;
                                                                              }
                                                  Severity: Major
                                                  Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 45 mins to fix

                                                    Method range has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        public static int range(byte[] _pat, int pat, int pend, char test, int flags) {
                                                    Severity: Minor
                                                    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                      Method call has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                              public int call(byte[] ptr, int p, int len, Encoding enc, GlobArgs args) {
                                                      Severity: Minor
                                                      Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                        Method call has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                                public int call(byte[] ptr, int p, int len, Encoding enc, List<ByteList> ary) {
                                                        Severity: Minor
                                                        Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                          Method call has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                                  int call(byte[] ptr, int p, int len, Encoding enc, T ary);
                                                          Severity: Minor
                                                          Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                            Method push_braces has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                                private static int push_braces(Ruby runtime, String cwd, List<ByteList> result, GlobPattern pattern, boolean sort) {
                                                            Severity: Minor
                                                            Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                              Method helper has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                                      int helper(byte[] pbytes, int pend, byte[] sbytes, int send, Encoding enc) {
                                                              Severity: Minor
                                                              Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

                                                                Method push_glob has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                    public static List<ByteList> push_glob(Ruby runtime, String cwd, ByteList globByteList, int flags, boolean sort) {
                                                                Severity: Minor
                                                                Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 35 mins to fix

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

                                                                      private static boolean isSpecialFile(String name) {
                                                                          int length = name.length();
                                                                  
                                                                          if (length < 1 || length > 3 || name.charAt(0) != '.') return false;
                                                                          if (length == 1) return true;
                                                                  Severity: Minor
                                                                  Found in assets/app/src/main/java/org/jruby/util/Dir.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

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              return ok == not ? -1 : p + 1;
                                                                  Severity: Major
                                                                  Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                        return FNM_NOMATCH;
                                                                    Severity: Major
                                                                    Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                          if (t2 >= pend) return -1;
                                                                      Severity: Major
                                                                      Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                                        return FNM_NOMATCH;
                                                                        Severity: Major
                                                                        Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                                          return FNM_NOMATCH;
                                                                          Severity: Major
                                                                          Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                                            return isEnd(pbytes, p, pend) ? 0 : FNM_NOMATCH;
                                                                            Severity: Major
                                                                            Found in assets/app/src/main/java/org/jruby/util/Dir.java - About 30 mins to fix

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

                                                                                              rbrace > 0 && pattern.bytes[rbrace-1] == '\\' && (rbrace <= 1 || pattern.bytes[rbrace-2] != '\\')) {
                                                                              Severity: Minor
                                                                              Found in assets/app/src/main/java/org/jruby/util/Dir.java and 1 other location - About 40 mins to fix
                                                                              assets/app/src/main/java/org/jruby/util/Dir.java on lines 508..508

                                                                              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 52.

                                                                              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

                                                                                              lbrace > 0 && pattern.bytes[lbrace-1] == '\\' && (lbrace <= 1 || pattern.bytes[lbrace-2] != '\\') ||
                                                                              Severity: Minor
                                                                              Found in assets/app/src/main/java/org/jruby/util/Dir.java and 1 other location - About 40 mins to fix
                                                                              assets/app/src/main/java/org/jruby/util/Dir.java on lines 509..509

                                                                              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 52.

                                                                              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

                                                                              There are no issues that match your filters.

                                                                              Category
                                                                              Status