buttercup-pw/buttercup-core

View on GitHub

Showing 67 of 185 total issues

Function readFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        readFile: (remotePath, options, callback) => {
            const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
            const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
            const cb = typeof options === "function" ? options : callback;
            const url = joinURL(BASE_URL, "/get/file");
Severity: Minor
Found in source/web/localFileClient.ts - About 1 hr to fix

    Function consumeEntryFacade has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function consumeEntryFacade(entry: Entry, facade: EntryFacade) {
        const facadeType = getEntryFacadeType(entry);
        if (facade && facade.type) {
            const properties = entry.getProperty();
            const attributes = entry.getAttribute();
    Severity: Minor
    Found in source/facades/entry.ts - About 1 hr to fix

      Function consumeGroupFacade has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function consumeGroupFacade(group: Group, facade: GroupFacade) {
          const { id, title, type, attributes } = facade;
          const existingAttributes = group.getAttribute();
          if (type !== "group") {
              throw new Error(`Failed consuming group facade: Invalid facade type: ${type}`);
      Severity: Minor
      Found in source/facades/vault.ts - About 1 hr to fix

        Function historiesDiffer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function historiesDiffer(historyA: History, historyB: History) {
            const vaultA = inflateHistory(historyA);
            const vaultB = inflateHistory(historyB);
            if (vaultA.e.length !== vaultB.e.length) return true;
            if (vaultA.g.length !== vaultB.g.length) return true;
        Severity: Minor
        Found in source/io/formatB/compare.ts - About 1 hr to fix

          Function lock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async lock() {
                  if (this.status !== VaultSource.STATUS_UNLOCKED) {
                      throw new Layerr(`Failed locking source: Source in invalid state (${this.status}): ${this.id}`);
                  }
                  await this._enqueueStateChange(async () => {
          Severity: Minor
          Found in source/core/VaultSource.ts - About 1 hr to fix

            Function results has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    const results = this._entries.reduce((output, entryItem) => {
                        let bestScore = Infinity;
                        const bestURL = entryItem.urls.reduce((best, next) => {
                            const thisDomain = extractDomain(next);
                            if (!thisDomain) return best;
            Severity: Minor
            Found in source/search/BaseSearch.ts - About 1 hr to fix

              Function createEntryFacade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export function createEntryFacade(entry?: Entry, options: CreateEntryFacadeOptions = {}): EntryFacade {
                  if (entry && entry instanceof Entry !== true) {
                      throw new Error("Failed creating entry facade: Provided item is not an Entry");
                  }
                  const { type } = options;
              Severity: Minor
              Found in source/facades/entry.ts - About 55 mins 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 valuesDiffer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export function valuesDiffer(value1: FormatBValue, value2: FormatBValue): boolean {
                  for (const prop of ["value", "created", "updated"]) {
                      if (value1[prop] !== value2[prop]) return true;
                  }
                  if (value1.history.length !== value2.history.length) return true;
              Severity: Minor
              Found in source/io/formatB/compare.ts - About 55 mins 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 findGroupByCheck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              function findGroupByCheck(groups, checkFn) {
                  for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
                      if (checkFn(groups[i]) === true) {
                          return groups[i];
                      }
              Severity: Minor
              Found in source/io/formatA/tools.ts - About 55 mins 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 moveTo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  moveTo(target: Group | Vault): this {
                      if (this.isTrash()) {
                          throw new Error("Trash group cannot be moved");
                      }
                      let targetVault, targetGroupID;
              Severity: Minor
              Found in source/core/Group.ts - About 45 mins 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 setEntryValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  entry: Entry,
                  propertyType: EntryPropertyType,
                  property: string,
                  value: string,
                  valueType?: EntryPropertyValueType
              Severity: Minor
              Found in source/facades/entry.ts - About 35 mins to fix

                Function executeSetEntryAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    archive: FormatAVault,
                    opts: any,
                    entryID: EntryID,
                    attribute: string,
                    value: string
                Severity: Minor
                Found in source/io/formatA/commands.ts - About 35 mins to fix

                  Function executeSetEntryProperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      archive: FormatAVault,
                      opts: any,
                      entryID: EntryID,
                      property: string,
                      value: string
                  Severity: Minor
                  Found in source/io/formatA/commands.ts - About 35 mins to fix

                    Function executeSetGroupAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        archive: FormatAVault,
                        opts: any,
                        groupID: GroupID,
                        attribute: string,
                        value: string
                    Severity: Minor
                    Found in source/io/formatA/commands.ts - About 35 mins to fix

                      Function createFieldDescriptor has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          entry: Entry | null,
                          title: string,
                          entryPropertyType: EntryPropertyType,
                          entryPropertyName: string,
                          options: CreateFieldDescriptorOptions = {}
                      Severity: Minor
                      Found in source/facades/tools.ts - About 35 mins to fix

                        Function findGroupContainingGroupID has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function findGroupContainingGroupID(group: FormatAGroup | FormatAVault, id: GroupID) {
                            const groups = group.groups || [];
                            for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
                                if (groups[i].id === id) {
                                    return {
                        Severity: Minor
                        Found in source/io/formatA/tools.ts - About 35 mins 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 getEntryFacadePath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getEntryFacadePath(entryID: EntryID, facade: VaultFacade): Array<GroupID> {
                            const entry = facade.entries.find(entry => entry.id === entryID);
                            if (!entry) {
                                throw new Error(`No entry facade found for ID: ${entryID}`);
                            }
                        Severity: Minor
                        Found in source/facades/entry.ts - About 35 mins 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 flatten has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            flatten(force: boolean = false): boolean {
                                const history = this.format.history;
                                const preservedLines = [];
                                const tempFormat = new VaultFormatA();
                                let availableLines = history.length - Flattener.PRESERVE_LINES;
                        Severity: Minor
                        Found in source/io/formatA/Flattener.ts - About 35 mins 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

                        Avoid too many return statements within this function.
                        Open

                                        return 0;
                        Severity: Major
                        Found in source/search/BaseSearch.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return true;
                          Severity: Major
                          Found in source/io/formatA/VaultComparator.ts - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language