buttercup-pw/buttercup-core

View on GitHub

Showing 203 of 203 total issues

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 216..233

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 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 197..214

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 VaultSource.ts has 532 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

    File VaultFormatA.ts has 473 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

      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 } = getCredentials(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 } = getCredentials(credentials.id);
          Severity: Minor
          Found in source/io/VaultFormatB.ts - About 6 hrs to fix

            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 6 hrs to fix
            source/io/VaultFormatB.ts on lines 419..429
            source/io/VaultFormatB.ts on lines 431..441

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

            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 6 hrs to fix
            source/io/VaultFormatB.ts on lines 407..417
            source/io/VaultFormatB.ts on lines 431..441

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

            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

                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 6 hrs to fix
            source/io/VaultFormatB.ts on lines 407..417
            source/io/VaultFormatB.ts on lines 419..429

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

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

            File VaultFormatB.ts has 398 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 { getCredentials } from "../credentials/channel.js";
            Severity: Minor
            Found in source/io/VaultFormatB.ts - About 5 hrs to fix

              Function consumeVaultFacade has 134 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function consumeVaultFacade(vault: Vault, facade: VaultFacade, options: ConsumeVaultFacadeOptions = {}) {
                  if (facade._ver !== FACADE_VERSION) {
                      throw new Error("Invalid vault facade version");
                  }
                  if (!facade || (facade && facade.type !== "vault")) {
              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

                      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 } = getCredentials(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 46..55

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

                  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 } = getCredentials(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 93..102

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

                  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 100 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";
                      const currentGroupID = isVault ? "0" : dataset.id;
                      const entries = currentGroupID === "0" ? [] : (<FormatAGroup>dataset).entries || [];
                      var commands = [];
                  Severity: Major
                  Found in source/io/formatA/describe.ts - About 4 hrs to fix

                    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 3 hrs to fix
                    source/io/VaultFormatB.ts on lines 150..156

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

                    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

                        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 3 hrs to fix
                    source/io/VaultFormatB.ts on lines 170..176

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language