buttercup-pw/buttercup-core

View on GitHub

Showing 216 of 216 total issues

File VaultSource.ts has 619 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import EventEmitter from "eventemitter3";
import { ChannelQueue } from "@buttercup/channel-queue";
import { Layerr } from "layerr";
import { Vault } from "./Vault.js";
import { Credentials } from "../credentials/Credentials.js";
Severity: Major
Found in source/core/VaultSource.ts - About 1 day to fix

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

    export function executeSetEntryProperty(
        archive: FormatAVault,
        opts: any,
        entryID: EntryID,
        property: string,
    Severity: Major
    Found in source/io/formatA/commands.ts and 1 other location - About 1 day to fix
    source/io/formatA/commands.ts on lines 252..272

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

    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 function executeSetEntryAttribute(
        archive: FormatAVault,
        opts: any,
        entryID: EntryID,
        attribute: string,
    Severity: Major
    Found in source/io/formatA/commands.ts and 1 other location - About 1 day to fix
    source/io/formatA/commands.ts on lines 274..294

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

    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

    File VaultFormatA.ts has 483 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Layerr } from "layerr";
    import { VaultFormat } from "./VaultFormat.js";
    import { Vault } from "../core/Vault.js";
    import { Credentials } from "../credentials/Credentials.js";
    import {
    Severity: Minor
    Found in source/io/VaultFormatA.ts - About 7 hrs to fix

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

          setGroupAttribute(groupID: GroupID, attribute: string, value: string) {
              const group = this.source.g.find((g: FormatBGroup) => g.id === groupID);
              if (!group.a[attribute]) {
                  group.a[attribute] = newRawValue(value);
              } else {
      Severity: Major
      Found in source/io/VaultFormatB.ts and 2 other locations - About 7 hrs to fix
      source/io/VaultFormatB.ts on lines 428..439
      source/io/VaultFormatB.ts on lines 441..452

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

      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 3 locations. Consider refactoring.
      Open

          setEntryProperty(entryID: EntryID, property: string, value: string) {
              const entry = this.source.e.find((e: FormatBEntry) => e.id === entryID);
              if (!entry.p[property]) {
                  entry.p[property] = newRawValue(value);
              } else {
      Severity: Major
      Found in source/io/VaultFormatB.ts and 2 other locations - About 7 hrs to fix
      source/io/VaultFormatB.ts on lines 428..439
      source/io/VaultFormatB.ts on lines 454..465

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

      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 3 locations. Consider refactoring.
      Open

          setEntryAttribute(entryID: EntryID, attribute: string, value: string) {
              const entry = this.source.e.find((e: FormatBEntry) => e.id === entryID);
              if (!entry.a[attribute]) {
                  entry.a[attribute] = newRawValue(value);
              } else {
      Severity: Major
      Found in source/io/VaultFormatB.ts and 2 other locations - About 7 hrs to fix
      source/io/VaultFormatB.ts on lines 441..452
      source/io/VaultFormatB.ts on lines 454..465

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

      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

      VaultFormat has 50 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class VaultFormat extends EventEmitter {
          static encodeRaw(rawContent: History, credentials: Credentials) {
              notImplemented();
          }
      
      
      Severity: Minor
      Found in source/io/VaultFormat.ts - About 7 hrs to fix

        VaultFormatA has 50 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class VaultFormatA extends VaultFormat {
            static async encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
                const compress = getSharedAppEnv().getProperty("compression/v1/compressText");
                const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
                const masterPassword = getMasterPassword(credentials.id);
        Severity: Minor
        Found in source/io/VaultFormatA.ts - About 7 hrs to fix

          VaultFormatB has 48 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class VaultFormatB extends VaultFormat {
              static encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
                  const compress = getSharedAppEnv().getProperty("compression/v2/compressText");
                  const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
                  const masterPassword = getMasterPassword(credentials.id);
          Severity: Minor
          Found in source/io/VaultFormatB.ts - About 6 hrs to fix

            File VaultFormatB.ts has 423 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { ORPHANS_GROUP_TITLE, VaultFormat } from "./VaultFormat.js";
            import { Vault } from "../core/Vault.js";
            import { generateUUID } from "../tools/uuid.js";
            import { getSharedAppEnv } from "../env/appEnv.js";
            import { getMasterPassword } from "../credentials/memory/password.js";
            Severity: Minor
            Found in source/io/VaultFormatB.ts - About 6 hrs to fix

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

                          encrypt(remotePath, token)
                              .then((payload) =>
                                  fetch(url, {
                                      method: "POST",
                                      headers: {
              Severity: Major
              Found in source/web/localFileClient.ts and 1 other location - About 5 hrs to fix
              source/web/localFileClient.ts on lines 12..31

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

              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

                          encrypt(remotePath, token)
                              .then((payload) =>
                                  fetch(url, {
                                      method: "POST",
                                      headers: {
              Severity: Major
              Found in source/web/localFileClient.ts and 1 other location - About 5 hrs to fix
              source/web/localFileClient.ts on lines 41..62

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

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

              export function consumeVaultFacade(
                  vault: Vault,
                  facade: VaultFacade,
                  options: ConsumeVaultFacadeOptions = {}
              ) {
              Severity: Major
              Found in source/facades/vault.ts - About 5 hrs to fix

                VaultSource has 38 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class VaultSource extends EventEmitter {
                    static STATUS_LOCKED = VaultSourceStatus.Locked;
                    static STATUS_PENDING = VaultSourceStatus.Pending;
                    static STATUS_UNLOCKED = VaultSourceStatus.Unlocked;
                
                
                Severity: Minor
                Found in source/core/VaultSource.ts - About 5 hrs to fix

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

                      deleteEntry(entryID: EntryID) {
                          const ind = this.source.e.findIndex((entry) => entry.id === entryID);
                          if (ind >= 0) {
                              this.source.e.splice(ind, 1);
                              this.source.del.e[entryID] = Date.now();
                  Severity: Major
                  Found in source/io/VaultFormatB.ts and 1 other location - About 4 hrs to fix
                  source/io/VaultFormatB.ts on lines 181..188

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

                  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

                      deleteGroup(groupID: GroupID) {
                          const ind = this.source.g.findIndex((group) => group.id === groupID);
                          if (ind >= 0) {
                              this.source.g.splice(ind, 1);
                              this.source.del.g[groupID] = Date.now();
                  Severity: Major
                  Found in source/io/VaultFormatB.ts and 1 other location - About 4 hrs to fix
                  source/io/VaultFormatB.ts on lines 158..165

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

                  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

                      static encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
                          const compress = getSharedAppEnv().getProperty("compression/v2/compressText");
                          const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
                          const masterPassword = getMasterPassword(credentials.id);
                          return Promise.resolve()
                  Severity: Major
                  Found in source/io/VaultFormatB.ts and 1 other location - About 4 hrs to fix
                  source/io/VaultFormatA.ts on lines 99..108

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

                  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

                      static async encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
                          const compress = getSharedAppEnv().getProperty("compression/v1/compressText");
                          const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
                          const masterPassword = getMasterPassword(credentials.id);
                          return Promise.resolve()
                  Severity: Major
                  Found in source/io/VaultFormatA.ts and 1 other location - About 4 hrs to fix
                  source/io/VaultFormatB.ts on lines 51..60

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

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

                  export function describeVaultDataset(
                      dataset: FormatAVault | FormatAGroup,
                      parentGroupID: GroupID
                  ): History {
                      const isVault = typeof (<FormatAVault>dataset).format === "string";
                  Severity: Major
                  Found in source/io/formatA/describe.ts - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language