leonitousconforti/tinyburg

View on GitHub

Showing 100 of 824 total issues

Function loadFromVersion has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const loadFromVersion = async (version: string, force = false, log: ILogger = debug): Promise<IStructs> => {
    log.debug("Attempting to load structs for version: %s", version);

    // Filter the folders in this directory for ones that match the version
    const folders = await fs.readdir(new URL(".", import.meta.url), { withFileTypes: true });
Severity: Minor
Found in packages/nucleus/src/parsing-structs/load-from-version.ts - 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

Function maskImage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const maskImage = (sourceImage: Image, mask: Image, threshold: number, crop = false): Image => {
    sourceImageGuard(mask);
    sourceImageGuard(sourceImage);
    uint8safeIntegerGuard(threshold);
    assert(mask.channels === 1, "Mask image must have exactly one channel");
Severity: Minor
Found in packages/doorman/src/image-operations/mask-image.ts - About 2 hrs to fix

    Function _trimNpmrcFile has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function _trimNpmrcFile(options) {
        const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options;
        const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath);
        if (combinedNpmrcFromCache !== undefined) {
            return combinedNpmrcFromCache;
    Severity: Minor
    Found in common/scripts/install-run.js - About 1 hr to fix

      Function populateSharedDataVolume has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Effect.gen(function* () {
              const volumes: MobyApi.Volumes.Volumes = yield* MobyApi.Volumes.Volumes;
              const containers: MobyApi.Containers.Containers = yield* MobyApi.Containers.Containers;
              yield* Effect.logInfo("Populating shared emulator data volume...");
      
      

        Function installAndRun has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
            const rushJsonFolder = findRushJsonFolder();
            const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common');
            const rushTempFolder = _getRushTempFolder(rushCommonFolder);
            const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
        Severity: Minor
        Found in common/scripts/install-run.js - About 1 hr to fix

          Function whichSaveIsBetter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export const whichSaveIsBetter = async function <T extends INimblebitJsonSave | DecompressedSave>(
              save1: T,
              save2: T,
              forceLoadStructs: boolean = false,
              logger: ILogger = debug
          Severity: Minor
          Found in packages/nucleus/src/compare-saves.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

          Function _waitForDependencies has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private async _waitForDependencies<T extends DependencyLoader>(
                  dependencyLoader: T,
                  retries: number,
                  waitMs: number
              ): Promise<ReturnType<T>> {
          Severity: Minor
          Found in packages/insight/src/agents/base-frida-agent.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

          Function _run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _run() {
              const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
              // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
              // appropriate binary inside the rush package to run
              const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath);
          Severity: Minor
          Found in common/scripts/install-run-rush.js - About 1 hr to fix

            Function concatenationSubRoutine has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const concatenationSubRoutine = function <T extends GenericBlocks, U extends GenericJsonSave<T>>(
                jsonSave: U,
                blocksToUse: T,
                log: ILogger = debug
            ): DecompressedSave {
            Severity: Minor
            Found in packages/nucleus/src/parsing-structs/parsing-subroutines.ts - About 1 hr to fix

              Function retrieveData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public retrieveData() {
                      // Extract the version of the game
                      const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
              
                      // Extract the FloorType enum fields
              Severity: Minor
              Found in packages/insight/src/agents/get-floor-data.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

              Function retrieveData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public retrieveData() {
                      // Extract the version of the game
                      const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
              
                      // Extract the FloorType enum fields
              Severity: Minor
              Found in packages/insight/src/agents/get-floor-data.ts - About 1 hr to fix

                Function _waitForDependencies has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private async _waitForDependencies<T extends DependencyLoader>(
                        dependencyLoader: T,
                        retries: number,
                        waitMs: number
                    ): Promise<ReturnType<T>> {
                Severity: Minor
                Found in packages/insight/src/agents/base-frida-agent.ts - About 1 hr to fix

                  Function sort has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public sort(compare: (a: NodeData, b: NodeData) => boolean): DoublyLinkedList<NodeData> {
                          if (this._head === undefined || this._tail === undefined) {
                              return this;
                          }
                          if (this.length < 2) {
                  Severity: Minor
                  Found in packages/bitprints/src/doubly-linked-list.ts - About 1 hr 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 checkForNewerSave has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const checkForNewerSave = async (
                          config: IConfig,
                          { saveVersion }: ICheckForNewerSaveParameters,
                          logger: ILogger = debug
                      ): Promise<number> => {
                      Severity: Minor
                      Found in packages/nucleus/src/endpoints/check-for-newer-save.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

                      Function preHandler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const preHandler = async function (request: Request, reply: Reply): Promise<void> {
                          request.log.debug({ req: request }, "preHandler hook fired");
                      
                          // Parse query params
                          const hash = request.query.hash;
                      Severity: Minor
                      Found in apps/authproxy/src/routes/v1/pre-handler.ts - About 1 hr to fix

                        Function downloadSave has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const downloadSave = async (config: IConfig, logger: ILogger = debug): Promise<DecompressedSave> => {
                            // Setup logging
                            const passLogger = logger === debug ? undefined : logger;
                            logger.info("Starting download of current cloud save data...");
                        
                        
                        Severity: Minor
                        Found in packages/nucleus/src/endpoints/download-save.ts - About 1 hr to fix

                          Function useStrategy has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const useStrategy = (): FiniteStateMachine<TinyTowerRebuildAsapStrategyStates, ITinyTowerRebuildEventData> => {
                              /**
                               * Rebuild after 50 floors so we get a golden ticket every time. There is no
                               * reason that this can't be a function that takes in the above event data
                               * and makes a decision using more data, but for this example this will do.
                          Severity: Minor
                          Found in packages/bitprints/src/strategies/rebuild-every-x-floors.ts - About 1 hr to fix

                            Function dropChannel has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const dropChannel = (
                                sourceImage: Image,
                                dropChannel: number,
                                newFormat?: ImageType
                            ): { modifiedSourceImage: Image; droppedChannelImage: Image } => {
                            Severity: Minor
                            Found in packages/doorman/src/image-operations/drop-channel.ts - About 1 hr to fix

                              Function retrieveData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public retrieveData() {
                                      // Extract the version of the game
                                      const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
                              
                                      // Extract some constants about accessories (maybe move these to costume structs?)
                              Severity: Minor
                              Found in packages/insight/src/agents/get-bitizen-data.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language