buttercup-pw/buttercup-core

View on GitHub

Showing 184 of 184 total issues

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

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 218..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 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 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

    export default class VaultFormatA extends VaultFormat {
        static 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: Major
    Found in source/io/VaultFormatA.ts - About 7 hrs to fix

      File VaultSource.ts has 462 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";
      import Credentials from "../credentials/Credentials";
      Severity: Minor
      Found in source/core/VaultSource.ts - About 7 hrs to fix

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

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

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

          export default 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 347..357
            source/io/VaultFormatB.ts on lines 359..369

            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 335..345
            source/io/VaultFormatB.ts on lines 359..369

            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 335..345
            source/io/VaultFormatB.ts on lines 347..357

            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

            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

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

                  static 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 40..49

              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

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

              export default 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 4 hrs to fix

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

                    constructor(credentials: Credentials) {
                        super(credentials);
                        const { data: credentialData } = getCredentials(credentials.id);
                        const { datasource: datasourceConfig } = credentialData;
                        const { token, path } = datasourceConfig;
                Severity: Major
                Found in source/datasources/DropboxDatasource.ts and 1 other location - About 4 hrs to fix
                source/web/LocalFileDatasource.ts on lines 19..29

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

                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

                    constructor(credentials: Credentials) {
                        super(credentials);
                        const { data: credentialData } = getCredentials(credentials.id);
                        const { datasource: datasourceConfig } = credentialData;
                        const { path, token } = datasourceConfig;
                Severity: Major
                Found in source/web/LocalFileDatasource.ts and 1 other location - About 4 hrs to fix
                source/datasources/DropboxDatasource.ts on lines 23..33

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

                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 applyNativeConfiguration(appEnv: AppEnv) {
                    appEnv.setProperties(getCryptoResources());
                    appEnv.setProperties(getV1CompressionResources());
                    appEnv.setProperties(getV2CompressionResources());
                    appEnv.setProperties(getEnvironmentResources());
                Severity: Major
                Found in source/env/native/index.ts and 1 other location - About 4 hrs to fix
                source/env/web/index.ts on lines 10..18

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

                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 applyWebConfiguration(appEnv: AppEnv) {
                    appEnv.setProperties(getCryptoResources());
                    appEnv.setProperties(getV1CompressionResources());
                    appEnv.setProperties(getV2CompressionResources());
                    appEnv.setProperties(getEnvironmentResources());
                Severity: Major
                Found in source/env/web/index.ts and 1 other location - About 4 hrs to fix
                source/env/native/index.ts on lines 10..18

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

                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