leonitousconforti/tinyburg

View on GitHub
packages/insight/src/helpers/read.ts

Summary

Maintainability
C
1 day
Test Coverage

Function readObject has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const readObject = (
    object: Il2Cpp.Object
): boolean | number | string | NativePointer | unknown[] | undefined => {
    switch (object.class.type.typeEnum) {
        case Il2Cpp.Type.enum.void: {
Severity: Major
Found in packages/insight/src/helpers/read.ts - About 2 hrs to fix

    Function readField has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const readField = (field: Il2Cpp.Field): string | number | boolean | NativePointer | undefined | unknown[] => {
        switch (field.type.typeEnum) {
            case Il2Cpp.Type.enum.void: {
                return undefined;
            }
    Severity: Minor
    Found in packages/insight/src/helpers/read.ts - About 1 hr to fix

      Function readObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export const readObject = (
          object: Il2Cpp.Object
      ): boolean | number | string | NativePointer | unknown[] | undefined => {
          switch (object.class.type.typeEnum) {
              case Il2Cpp.Type.enum.void: {
      Severity: Minor
      Found in packages/insight/src/helpers/read.ts - 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

      Avoid too many return statements within this function.
      Open

                  return (field as Il2Cpp.Field<Il2Cpp.ValueType>).value.toString();
      Severity: Major
      Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return string;
        Severity: Major
        Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return (object as unknown as Il2Cpp.ValueType).toString();
          Severity: Major
          Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return Object.fromEntries(entries);
            Severity: Major
            Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return undefined;
              Severity: Major
              Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return (field as Il2Cpp.Field<Il2Cpp.String>).value.content!;
                Severity: Major
                Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return copyArrayToJs(object as unknown as Il2Cpp.Array<Il2Cpp.Object>).map((value) => readObject(value));
                  Severity: Major
                  Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return copyListToJs<Il2Cpp.Object>(object).map((value) => readObject(value));
                    Severity: Major
                    Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return undefined;
                      Severity: Major
                      Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return undefined;
                        Severity: Major
                        Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      if (string === "") return "__Empty String__";
                          Severity: Major
                          Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return undefined;
                            Severity: Major
                            Found in packages/insight/src/helpers/read.ts - About 30 mins to fix

                              There are no issues that match your filters.

                              Category
                              Status