hackedteam/core-blackberry

View on GitHub
RCSBlackBerry/src/rpc/json/me/JSONObject.java

Summary

Maintainability
F
6 days
Test Coverage

File JSONObject.java has 598 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//#preprocess

/* *************************************************
 * Copyright (c) 2010 - 2012
 * HT srl,   All rights reserved.
Severity: Major
Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 1 day to fix

    JSONObject has 49 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class JSONObject {
    
        /**
         * JSONObject.NULL is equivalent to the value that JavaScript calls null,
         * whilst Java's null is equivalent to the value that JavaScript calls
    Severity: Minor
    Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 6 hrs to fix

      Method toString has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          String toString(int indentFactor, int indent) throws JSONException {
              int i;
              int n = length();
              if (n == 0) {
                  return "{}"; //$NON-NLS-1$
      Severity: Minor
      Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 write has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public Writer write(Writer writer) throws JSONException {
              try {
                  boolean b = false;
                  Enumeration keys = keys();
                  writer.write('{');
      Severity: Minor
      Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 quote has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static String quote(String string) {
              if (string == null || string.length() == 0) {
                  return "\"\""; //$NON-NLS-1$
              }
      
      
      Severity: Major
      Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 2 hrs to fix

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

            String toString(int indentFactor, int indent) throws JSONException {
                int i;
                int n = length();
                if (n == 0) {
                    return "{}"; //$NON-NLS-1$
        Severity: Minor
        Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 1 hr to fix

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

              public static String quote(String string) {
                  if (string == null || string.length() == 0) {
                      return "\"\""; //$NON-NLS-1$
                  }
          
          
          Severity: Minor
          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 testValidity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              static void testValidity(Object o) throws JSONException {
                  if (o != null) {
                      if (o instanceof Double) {
                          if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
                              throw new JSONException(Messages.getString("21.41")); //$NON-NLS-1$
          Severity: Minor
          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 valueToString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              static String valueToString(Object value) throws JSONException {
                  if (value == null || value.equals(null)) {
                      return "null"; //$NON-NLS-1$
                  }
                  if (value instanceof JSONString) {
          Severity: Minor
          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 valueToString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              static String valueToString(Object value, int indentFactor, int indent)
                      throws JSONException {
                  if (value == null || value.equals(null)) {
                      return "null"; //$NON-NLS-1$
                  }
          Severity: Minor
          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 valueToString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static String valueToString(Object value, int indentFactor, int indent)
                      throws JSONException {
                  if (value == null || value.equals(null)) {
                      return "null"; //$NON-NLS-1$
                  }
          Severity: Minor
          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 1 hr to fix

            Method write has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public Writer write(Writer writer) throws JSONException {
                    try {
                        boolean b = false;
                        Enumeration keys = keys();
                        writer.write('{');
            Severity: Minor
            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 1 hr to fix

              Method getDouble has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public double getDouble(String key) throws JSONException {
                      Object o = get(key);
                      if (o instanceof Byte) {
                          return (double) ((Byte) o).byteValue();
                      } else if (o instanceof Short) {
              Severity: Minor
              Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 55 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 doubleToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  static public String doubleToString(double d) {
                      if (Double.isInfinite(d) || Double.isNaN(d)) {
                          return "null"; //$NON-NLS-1$
                      }
              
              
              Severity: Minor
              Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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

              Consider simplifying this complex logical expression.
              Open

                      if (value instanceof Float || value instanceof Double
                              || value instanceof Byte || value instanceof Short
                              || value instanceof Integer || value instanceof Long) {
                          return numberToString(value);
                      }
              Severity: Major
              Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (value instanceof Float || value instanceof Double
                                || value instanceof Byte || value instanceof Short
                                || value instanceof Integer || value instanceof Long) {
                            return numberToString(value);
                        }
                Severity: Major
                Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 40 mins to fix

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

                      public int getInt(String key) throws JSONException {
                          Object o = get(key);
                          if (o instanceof Byte) {
                              return ((Byte) o).byteValue();
                          } else if (o instanceof Short) {
                  Severity: Minor
                  Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 getLong has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public long getLong(String key) throws JSONException {
                          Object o = get(key);
                          if (o instanceof Byte) {
                              return ((Byte) o).byteValue();
                          } else if (o instanceof Short) {
                  Severity: Minor
                  Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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 ((Byte) o).byteValue();
                  Severity: Major
                  Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return ((Integer) o).intValue();
                    Severity: Major
                    Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return ((JSONObject) value).toString(indentFactor, indent);
                      Severity: Major
                      Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return quote(value.toString());
                        Severity: Major
                        Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return (double) ((Integer) o).intValue();
                          Severity: Major
                          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return ((Integer) o).intValue();
                            Severity: Major
                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return ((Short) o).shortValue();
                              Severity: Major
                              Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return quote(value.toString());
                                Severity: Major
                                Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return (double) ((Byte) o).byteValue();
                                  Severity: Major
                                  Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return (double) ((Short) o).shortValue();
                                    Severity: Major
                                    Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return ((Short) o).shortValue();
                                      Severity: Major
                                      Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return ((JSONArray) value).toString(indentFactor, indent);
                                        Severity: Major
                                        Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return ((Byte) o).byteValue();
                                          Severity: Major
                                          Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java - About 30 mins to fix

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

                                                public boolean getBoolean(String key) throws JSONException {
                                                    Object o = get(key);
                                                    if (o.equals(Boolean.FALSE)
                                                            || (o instanceof String && ((String) o)
                                                                    .equalsIgnoreCase(Messages.getString("21.12")))) { //$NON-NLS-1$
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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

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

                                                static public String trimNumber(String s) {
                                                    if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
                                                        while (s.endsWith("0")) { //$NON-NLS-1$
                                                            s = s.substring(0, s.length() - 1);
                                                        }
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.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

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

                                                    if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
                                                        while (s.endsWith("0")) { //$NON-NLS-1$
                                                            s = s.substring(0, s.length() - 1);
                                                        }
                                                        if (s.endsWith(".")) { //$NON-NLS-1$
                                            Severity: Major
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 1 hr to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 348..355

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

                                            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

                                                    if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
                                                        while (s.endsWith("0")) { //$NON-NLS-1$
                                                            s = s.substring(0, s.length() - 1);
                                                        }
                                                        if (s.endsWith(".")) { //$NON-NLS-1$
                                            Severity: Major
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 1 hr to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 614..621

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

                                            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

                                                    } else if (o instanceof Float) {
                                                        return (int) ((Float) o).floatValue();
                                                    } else if (o instanceof Double) {
                                                        return (int) ((Double) o).doubleValue();
                                                    } else if (o instanceof String) {
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 45 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 528..534

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

                                            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

                                                    } else if (o instanceof Float) {
                                                        return (long) ((Float) o).floatValue();
                                                    } else if (o instanceof Double) {
                                                        return (long) ((Double) o).doubleValue();
                                                    } else if (o instanceof String) {
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 45 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 460..466

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

                                            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

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

                                                        switch (x.nextClean()) {
                                                            case ';':
                                                            case ',':
                                                                if (x.nextClean() == '}') {
                                                                    return;
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 45 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONArray.java on lines 130..142

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

                                            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

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

                                                public JSONArray getJSONArray(String key) throws JSONException {
                                                    Object o = get(key);
                                                    if (o instanceof JSONArray) {
                                                        return (JSONArray) o;
                                                    }
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 40 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 498..505

                                            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

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

                                                public JSONObject getJSONObject(String key) throws JSONException {
                                                    Object o = get(key);
                                                    if (o instanceof JSONObject) {
                                                        return (JSONObject) o;
                                                    }
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 40 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 480..487

                                            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

                                                    if (value instanceof Float || value instanceof Double
                                                            || value instanceof Byte || value instanceof Short
                                                            || value instanceof Integer || value instanceof Long) {
                                                        return numberToString(value);
                                                    }
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 35 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 1289..1293

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

                                            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

                                                    if (value instanceof Float || value instanceof Double
                                                            || value instanceof Byte || value instanceof Short
                                                            || value instanceof Integer || value instanceof Long) {
                                                        return numberToString(value);
                                                    }
                                            Severity: Minor
                                            Found in RCSBlackBerry/src/rpc/json/me/JSONObject.java and 1 other location - About 35 mins to fix
                                            RCSBlackBerry/src/rpc/json/me/JSONObject.java on lines 1244..1248

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

                                            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