weexteam/weex_devtools_android

View on GitHub
inspector/src/main/java/com/taobao/weex/devtools/inspector/domstorage/SharedPreferencesHelper.java

Summary

Maintainability
B
4 hrs
Test Coverage

Method valueFromString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  @Nullable
  public static Object valueFromString(String newValue, Object existingValue)
      throws IllegalArgumentException {
    if (existingValue instanceof Integer) {
      return Integer.parseInt(newValue);

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

  @Nullable
  public static Object valueFromString(String newValue, Object existingValue)
      throws IllegalArgumentException {
    if (existingValue instanceof Integer) {
      return Integer.parseInt(newValue);

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

      public static String valueToString(Object value) {
        if (value != null) {
          if (value instanceof Set) {
            JSONArray array = new JSONArray();
            for (String entry : (Set<String>)value) {

    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 Long.parseLong(newValue);

      Avoid too many return statements within this method.
      Open

            return Integer.parseInt(newValue);

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

          public static List<String> getSharedPreferenceTags(Context context) {
            ArrayList<String> tags = new ArrayList<String>();
        
            String rootPath = context.getApplicationInfo().dataDir + "/shared_prefs";
            File root = new File(rootPath);

        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

        There are no issues that match your filters.

        Category
        Status