buttercup-pw/buttercup-core

View on GitHub

Showing 216 of 216 total issues

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

    findGroupByID(id: GroupID): FormatBGroup {
        return this.source.g.find((group) => group.id === id) || null;
    }
Severity: Major
Found in source/io/VaultFormatB.ts and 1 other location - About 1 hr to fix
source/io/VaultFormatB.ts on lines 226..228

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

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 class VaultEntrySearch extends BaseSearch {
    constructor(
        vaults: Array<Vault>,
        memory?: StorageInterface,
        searcherFactory?: SearcherFactory
Severity: Major
Found in source/search/VaultEntrySearch.ts and 1 other location - About 1 hr to fix
source/search/VaultFacadeEntrySearch.ts on lines 47..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 56.

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

        constructor(credentials: Credentials) {
            super(credentials);
            const { data: credentialData } = getCredentials(credentials.id);
            const { datasource: datasourceConfig } = credentialData as {
                datasource: DatasourceConfigurationWebDAV;
    Severity: Minor
    Found in source/datasources/WebDAVDatasource.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 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

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

          export function stripSignature(text: string): string {
              const sigLen = BUTTERCUP_SIGNATURE.length;
              return text.substr(sigLen, text.length - sigLen);
          }
          Severity: Major
          Found in source/io/formatA/signing.ts and 1 other location - About 1 hr to fix
          source/io/formatB/signing.ts on lines 35..38

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

          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

          export function stripSignature(text: string): string {
              const sigLen = BUTTERCUP_SIGNATURE.length;
              return text.substr(sigLen, text.length - sigLen);
          }
          Severity: Major
          Found in source/io/formatB/signing.ts and 1 other location - About 1 hr to fix
          source/io/formatA/signing.ts on lines 43..46

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

          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

              findGroupByID(id: GroupID): FormatAGroup {
                  return this.getAllGroups().find((group) => group.id === id) || null;
              }
          Severity: Major
          Found in source/io/VaultFormatA.ts and 1 other location - About 1 hr to fix
          source/io/VaultFormatA.ts on lines 296..298

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

          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

              findEntryByID(id: EntryID): FormatAEntry {
                  return this.getAllEntries().find((entry) => entry.id === id) || null;
              }
          Severity: Major
          Found in source/io/VaultFormatA.ts and 1 other location - About 1 hr to fix
          source/io/VaultFormatA.ts on lines 300..302

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

          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

              const uniqueGroupsBase = base.g.filter(
                  (group) => !incoming.g.find((inGroup) => inGroup.id === group.id)
              );
          Severity: Major
          Found in source/io/formatB/merge.ts and 1 other location - About 1 hr to fix
          source/io/formatB/merge.ts on lines 98..100

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

          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

              const uniqueEntriesBase = base.e.filter(
                  (entry) => !incoming.e.find((inEntry) => inEntry.id === entry.id)
              );
          Severity: Major
          Found in source/io/formatB/merge.ts and 1 other location - About 1 hr to fix
          source/io/formatB/merge.ts on lines 76..78

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

          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

              setAttribute(attribute: string, value: string): this {
                  this.vault.format.setGroupAttribute(this.id, attribute, value);
                  return this;
              }
          Severity: Major
          Found in source/core/Group.ts and 2 other locations - About 55 mins to fix
          source/core/Entry.ts on lines 292..295
          source/core/Entry.ts on lines 303..306

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

          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

              setProperty(property: string, value: string): this {
                  this.vault.format.setEntryProperty(this.id, property, value);
                  return this;
              }
          Severity: Major
          Found in source/core/Entry.ts and 2 other locations - About 55 mins to fix
          source/core/Entry.ts on lines 292..295
          source/core/Group.ts on lines 306..309

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

          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

              setAttribute(attribute: string, value: string): this {
                  this.vault.format.setEntryAttribute(this.id, attribute, value);
                  return this;
              }
          Severity: Major
          Found in source/core/Entry.ts and 2 other locations - About 55 mins to fix
          source/core/Entry.ts on lines 303..306
          source/core/Group.ts on lines 306..309

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

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

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

                          await this._datasource.save(
                              this._vault.format.history,
                              prepareDatasourceCredentials(
                                  this._credentials as Credentials,
                                  this._datasource.type
          Severity: Minor
          Found in source/core/VaultSource.ts and 1 other location - About 55 mins to fix
          source/core/VaultSource.ts on lines 768..774

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

          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

                      await this._datasource.save(
                          this._vault.format.history,
                          prepareDatasourceCredentials(
                              this._credentials as Credentials,
                              this._datasource.type
          Severity: Minor
          Found in source/core/VaultSource.ts and 1 other location - About 55 mins to fix
          source/core/VaultSource.ts on lines 590..596

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

          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

                  return this.client.getFileContents(this.path).then((content) => {
                      this.setContent(content);
                      return super.load(credentials);
                  });
          Severity: Minor
          Found in source/datasources/DropboxDatasource.ts and 1 other location - About 55 mins to fix
          source/datasources/GoogleDriveDatasource.ts on lines 68..73

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

          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