leonitousconforti/tinyburg

View on GitHub

Showing 824 of 824 total issues

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

                <Form action={register}>
                    <SubmitButton>Sign Up</SubmitButton>
                    <p className="text-center text-sm text-gray-600">
                        {"Already have an account? "}
                        <Link href="/login" className="font-semibold text-gray-800">
Severity: Major
Found in apps/trading-site/app/register/page.tsx and 1 other location - About 1 hr to fix
apps/trading-site/app/login/page.tsx on lines 14..32

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

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

                <Form
                    action={async (formData: FormData) => {
                        "use server";
                        await signIn("credentials", {
                            redirectTo: "/protected",
Severity: Major
Found in apps/trading-site/app/login/page.tsx and 1 other location - About 1 hr to fix
apps/trading-site/app/register/page.tsx on lines 29..38

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

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

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

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

              const validationHashParameters: PullSnapshotValidationHashParameters = {
                  playerId: config.player.playerId,
                  salt,
                  saveVersion,
                  saveData,
      Severity: Major
      Found in packages/nucleus/src/endpoints/snapshots.ts and 1 other location - About 1 hr to fix
      packages/nucleus/src/endpoints/download-save.ts on lines 70..77

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

      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

      export type DownloadSaveValidationHashParameters = {
          playerId: string;
          salt: number;
          saveVersionAtNimblebit: number;
          saveData: string;
      Severity: Major
      Found in packages/nucleus/src/endpoints/download-save.ts and 1 other location - About 1 hr to fix
      packages/nucleus/src/endpoints/snapshots.ts on lines 228..235

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

      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

              const validationHashParameters: DownloadSaveValidationHashParameters = {
                  playerId: config.player.playerId,
                  salt,
                  saveVersionAtNimblebit,
                  saveData,
      Severity: Major
      Found in packages/nucleus/src/endpoints/download-save.ts and 1 other location - About 1 hr to fix
      packages/nucleus/src/endpoints/snapshots.ts on lines 196..203

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

      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

      export type PullSnapshotValidationHashParameters = {
          playerId: string;
          salt: number;
          saveVersion: number;
          saveData: string;
      Severity: Major
      Found in packages/nucleus/src/endpoints/snapshots.ts and 1 other location - About 1 hr to fix
      packages/nucleus/src/endpoints/download-save.ts on lines 105..112

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

      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

      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

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

              export default function Login() {
                  async function register(formData: FormData) {
                      "use server";
                      let email = formData.get("email") as string;
                      let password = formData.get("password") as string;
              Severity: Minor
              Found in apps/trading-site/app/register/page.tsx - About 1 hr to fix

                Function _transitionTo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private async _transitionTo(state: State, data: EventData): Promise<EventData | undefined> {
                        if (!this._exitCallbacks[this._currentState]) {
                            this._exitCallbacks[this._currentState] = [];
                        }
                
                
                Severity: Minor
                Found in packages/bitprints/src/fsm.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

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

                    loadDependencies() {
                        const csharpAssembly = Il2Cpp.domain.assembly("Assembly-CSharp");
                        const AppUtilClass = csharpAssembly.image.class("AppUtil");
                        return { csharpAssembly, AppUtilClass };
                    }
                Severity: Major
                Found in packages/insight/examples/js/agent.js and 1 other location - About 1 hr to fix
                packages/insight/examples/js-typed/agent.js on lines 19..23

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

                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

                    loadDependencies() {
                        const csharpAssembly = Il2Cpp.domain.assembly("Assembly-CSharp");
                        const AppUtilClass = csharpAssembly.image.class("AppUtil");
                        return { csharpAssembly, AppUtilClass };
                    }
                Severity: Major
                Found in packages/insight/examples/js-typed/agent.js and 1 other location - About 1 hr to fix
                packages/insight/examples/js/agent.js on lines 18..22

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

                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

                Function maskImage has a Cognitive Complexity of 11 (exceeds 5 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 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 whichSaveIsBetter has 31 lines of code (exceeds 25 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

                  Function _transitionTo has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private async _transitionTo(state: State, data: EventData): Promise<EventData | undefined> {
                          if (!this._exitCallbacks[this._currentState]) {
                              this._exitCallbacks[this._currentState] = [];
                          }
                  
                  
                  Severity: Minor
                  Found in packages/bitprints/src/fsm.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language