buttercup-pw/buttercup-core

View on GitHub

Showing 83 of 216 total issues

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

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

                    static async fromSecureString(content: string, masterPassword: string): Promise<Credentials> {
                        const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
                        const decryptedContent = await decrypt(unsignEncryptedContent(content), masterPassword);
                        const credentialsData = JSON.parse(decryptedContent);
                        // Handle compatibility updates for legacy credentials
                Severity: Minor
                Found in source/credentials/Credentials.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 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

                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/formatB/compare.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return true;
                    Severity: Major
                    Found in source/io/formatA/merge.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return false;
                      Severity: Major
                      Found in source/io/formatB/compare.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

                          Function update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              async update({ skipDiff = false } = {}) {
                                  const didUpdate = await this._enqueueStateChange(
                                      () =>
                                          (skipDiff ? Promise.resolve(false) : this.localDiffersFromRemote()).then(
                                              (differs) => {
                          Severity: Minor
                          Found in source/core/VaultSource.ts - About 25 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 buildClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function buildClient(token: string) {
                              const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
                              const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
                              return {
                                  readdir: (remotePath, callback) => {
                          Severity: Minor
                          Found in source/web/localFileClient.ts - About 25 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

                          Severity
                          Category
                          Status
                          Source
                          Language