cozy-labs/cozy-desktop

View on GitHub
core/remote/watcher/index.js

Summary

Maintainability
F
5 days
Test Coverage

File index.js has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @module core/remote/watcher
 * @flow
 */

Severity: Major
Found in core/remote/watcher/index.js - About 1 day to fix

    Function apply has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async apply(
        change /*: RemoteChange */
      ) /*: Promise<?{ change: RemoteChange, err: Error }> */ {
        const docType = _.get(change, 'doc.docType')
        const path = _.get(change, 'doc.path')
    Severity: Major
    Found in core/remote/watcher/index.js - About 4 hrs to fix

      Function identifyExistingDocChange has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        identifyExistingDocChange(
          remoteDoc /*: CouchDBDoc|FullRemoteFile|RemoteDir */,
          was /*: ?SavedMetadata */,
          previousChanges /*: Array<RemoteChange> */,
          originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
      Severity: Major
      Found in core/remote/watcher/index.js - About 3 hrs to fix

        Function identifyExistingDocChange has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          identifyExistingDocChange(
            remoteDoc /*: CouchDBDoc|FullRemoteFile|RemoteDir */,
            was /*: ?SavedMetadata */,
            previousChanges /*: Array<RemoteChange> */,
            originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
        Severity: Minor
        Found in core/remote/watcher/index.js - About 2 hrs 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 apply has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          async apply(
            change /*: RemoteChange */
          ) /*: Promise<?{ change: RemoteChange, err: Error }> */ {
            const docType = _.get(change, 'doc.docType')
            const path = _.get(change, 'doc.path')
        Severity: Minor
        Found in core/remote/watcher/index.js - About 2 hrs 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

        RemoteWatcher has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class RemoteWatcher {
          /*::
          config: Config
          pouch: Pouch
          prep: Prep
        Severity: Minor
        Found in core/remote/watcher/index.js - About 2 hrs to fix

          Function identifyChange has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            identifyChange(
              remoteDoc /*: CouchDBDoc|CouchDBDeletion|FullRemoteFile|RemoteDir */,
              was /*: ?SavedMetadata */,
              previousChanges /*: Array<RemoteChange> */,
              originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
          Severity: Minor
          Found in core/remote/watcher/index.js - About 1 hr to fix

            Function identifyChange has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              identifyChange(
                remoteDoc /*: CouchDBDoc|CouchDBDeletion|FullRemoteFile|RemoteDir */,
                was /*: ?SavedMetadata */,
                previousChanges /*: Array<RemoteChange> */,
                originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
            Severity: Minor
            Found in core/remote/watcher/index.js - About 1 hr 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 watch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async watch() /*: Promise<?RemoteError> */ {
                const release = await this.pouch.lock(this)
                try {
                  if (!this.running) {
                    log.debug('Watcher stopped: skipping remote watch')
            Severity: Minor
            Found in core/remote/watcher/index.js - About 1 hr to fix

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

                async requestRun() {
                  if (!this.running) {
                    log.debug('Watcher stopped: skipping remote watcher run request')
                    return
                  }
              Severity: Minor
              Found in core/remote/watcher/index.js - 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 remoteChange.updated(doc)
              Severity: Major
              Found in core/remote/watcher/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return this.identifyExistingDocChange(
                          remoteDoc,
                          was,
                          previousChanges,
                          originalMoves,
                Severity: Major
                Found in core/remote/watcher/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return remoteChange.trashed(doc, was)
                  Severity: Major
                  Found in core/remote/watcher/index.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return squashMoves(doc, was, previousChanges, originalMoves)
                    Severity: Major
                    Found in core/remote/watcher/index.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return {
                                sideName,
                                type: 'IgnoredChange',
                                doc,
                                was,
                      Severity: Major
                      Found in core/remote/watcher/index.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return {
                                  sideName,
                                  type: 'InvalidChange',
                                  doc,
                                  was,
                        Severity: Major
                        Found in core/remote/watcher/index.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return remoteChange.added(doc)
                          Severity: Major
                          Found in core/remote/watcher/index.js - About 30 mins to fix

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

                                      if (change.needRefetch) {
                                        change.was = await this.pouch.byRemoteIdMaybe(change.was.remote._id)
                                        change.was.childMove = false
                                      }
                            Severity: Major
                            Found in core/remote/watcher/index.js and 1 other location - About 1 hr to fix
                            core/remote/watcher/index.js on lines 667..672

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

                            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

                                        if (change.needRefetch) {
                                          change.was = await this.pouch.byRemoteIdMaybe(
                                            change.was.remote._id
                                          )
                                          change.was.childMove = false
                            Severity: Major
                            Found in core/remote/watcher/index.js and 1 other location - About 1 hr to fix
                            core/remote/watcher/index.js on lines 652..655

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

                            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

                              identifyExistingDocChange(
                                remoteDoc /*: CouchDBDoc|FullRemoteFile|RemoteDir */,
                                was /*: ?SavedMetadata */,
                                previousChanges /*: Array<RemoteChange> */,
                                originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 50 mins to fix
                            core/remote/watcher/index.js on lines 389..450

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

                            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

                              identifyChange(
                                remoteDoc /*: CouchDBDoc|CouchDBDeletion|FullRemoteFile|RemoteDir */,
                                was /*: ?SavedMetadata */,
                                previousChanges /*: Array<RemoteChange> */,
                                originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 50 mins to fix
                            core/remote/watcher/index.js on lines 462..570

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

                            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

                                    case 'DirTrashing':
                                      log.info({ path }, 'folder was trashed remotely')
                                      await this.prep.trashFolderAsync(sideName, change.was, change.doc)
                                      break
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 45 mins to fix
                            core/remote/watcher/index.js on lines 615..618

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

                            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

                                    case 'FileTrashing':
                                      log.info({ path }, 'file was trashed remotely')
                                      await this.prep.trashFileAsync(sideName, change.was, change.doc)
                                      break
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 45 mins to fix
                            core/remote/watcher/index.js on lines 619..622

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'DirUpdate':
                                      log.info({ path }, 'folder was updated remotely')
                                      await this.prep.putFolderAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 623..626
                            core/remote/watcher/index.js on lines 627..630
                            core/remote/watcher/index.js on lines 631..634
                            core/remote/watcher/index.js on lines 635..638
                            core/remote/watcher/index.js on lines 639..642

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

                            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

                                  if (remoteDoc.type !== DIR_TYPE && remoteDoc.type !== FILE_TYPE) {
                                    return {
                                      sideName,
                                      type: 'InvalidChange',
                                      doc: remoteDoc,
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 30 mins to fix
                            core/remote/watcher/index.js on lines 485..492

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

                            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

                                if (doc.docType !== metadata.FILE && doc.docType !== metadata.FOLDER) {
                                  return {
                                    sideName,
                                    type: 'InvalidChange',
                                    doc,
                            Severity: Minor
                            Found in core/remote/watcher/index.js and 1 other location - About 30 mins to fix
                            core/remote/watcher/index.js on lines 421..448

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'DirDeletion':
                                      log.info({ path }, 'folder was deleted permanently')
                                      await this.prep.deleteFolderAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 623..626
                            core/remote/watcher/index.js on lines 631..634
                            core/remote/watcher/index.js on lines 635..638
                            core/remote/watcher/index.js on lines 639..642
                            core/remote/watcher/index.js on lines 643..646

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'FileAddition':
                                      log.info({ path }, 'file was added remotely')
                                      await this.prep.addFileAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 623..626
                            core/remote/watcher/index.js on lines 627..630
                            core/remote/watcher/index.js on lines 635..638
                            core/remote/watcher/index.js on lines 639..642
                            core/remote/watcher/index.js on lines 643..646

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'FileDeletion':
                                      log.info({ path }, 'file was deleted permanently')
                                      await this.prep.deleteFileAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 627..630
                            core/remote/watcher/index.js on lines 631..634
                            core/remote/watcher/index.js on lines 635..638
                            core/remote/watcher/index.js on lines 639..642
                            core/remote/watcher/index.js on lines 643..646

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'DirAddition':
                                      log.info({ path }, 'folder was added remotely')
                                      await this.prep.putFolderAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 623..626
                            core/remote/watcher/index.js on lines 627..630
                            core/remote/watcher/index.js on lines 631..634
                            core/remote/watcher/index.js on lines 639..642
                            core/remote/watcher/index.js on lines 643..646

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

                            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 6 locations. Consider refactoring.
                            Open

                                    case 'FileUpdate':
                                      log.info({ path }, 'file was updated remotely')
                                      await this.prep.updateFileAsync(sideName, change.doc)
                                      break
                            Severity: Major
                            Found in core/remote/watcher/index.js and 5 other locations - About 30 mins to fix
                            core/remote/watcher/index.js on lines 623..626
                            core/remote/watcher/index.js on lines 627..630
                            core/remote/watcher/index.js on lines 631..634
                            core/remote/watcher/index.js on lines 635..638
                            core/remote/watcher/index.js on lines 643..646

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

                            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

                            There are no issues that match your filters.

                            Category
                            Status