cozy-labs/cozy-desktop

View on GitHub

Showing 610 of 610 total issues

Avoid too many return statements within this function.
Open

  return null
Severity: Major
Found in core/local/channel_watcher/filter_ignored.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          if (docB.path.startsWith(docA.path + sep)) return -1
    Severity: Major
    Found in core/sync/index.js - About 30 mins to fix

      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

      Avoid too many return statements within this function.
      Open

            return { action: 'modified', kind, path: relativePath, ino }
      Severity: Major
      Found in core/local/channel_watcher/parcel_producer.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              if (docA.path.startsWith(docB.path + sep)) return 1
        Severity: Major
        Found in core/sync/index.js - About 30 mins to fix

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

                if (idConflict) {
                  log.warn({ idConflict }, IdConflict.description(idConflict))
                  return this.resolveConflictAsync(side, doc)
                }
          Severity: Major
          Found in core/merge.js and 3 other locations - About 30 mins to fix
          core/merge.js on lines 107..110
          core/merge.js on lines 514..517
          core/merge.js on lines 637..640

          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

          Avoid too many return statements within this function.
          Open

                if (docB.path.startsWith(docA.path + sep)) return -1
          Severity: Major
          Found in core/sync/index.js - About 30 mins to fix

            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

            Avoid too many return statements within this function.
            Open

                      return { type: 'NULL' }
            Severity: Major
            Found in core/sync/index.js - About 30 mins to fix

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

              module.exports.setEnabled = enabled => {
                autoLauncher
                  .isEnabled()
                  .then(was => {
                    if (was !== enabled) {
              Severity: Minor
              Found in gui/js/autolaunch.js - 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 addFileManagerShortcut has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports.addFileManagerShortcut = config => {
                if (platform === 'win32' && major >= 10) {
                  win10PinToHome(config.syncPath)
                } else if (platform === 'win32' && major >= 6) {
                  winAddLink(config.syncPath)
              Severity: Minor
              Found in gui/js/shortcut.js - 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 deleteFileAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async deleteFileAsync(side /*: SideName */, doc /*: SavedMetadata */) {
                  log.debug({ path: doc.path }, 'deleteFileAsync')
                  const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
              
                  if (!file) {
              Severity: Minor
              Found in core/merge.js - 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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const init = (app, listener) => {
                tray = new Tray(nativeImage.createEmpty())
              
                // XXX: updating the status should always come after the initialization of the
                // `tray` as we use it.
              Severity: Minor
              Found in gui/js/tray.js - 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.default = async function (configuration) {
                const { execSync } = require('child_process')
              
                const whoami = 'customSign.js'
              
              
              Severity: Minor
              Found in build/windows/customSign.js - 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 moveFolderAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async moveFolderAsync(
                  side /*: SideName */,
                  doc /*: Metadata */,
                  was /*: SavedMetadata */,
                  newRemoteRevs /*: ?RemoteRevisionsByID */
              Severity: Minor
              Found in core/prep.js - 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 moveFileAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async moveFileAsync(
                  side /*: SideName */,
                  doc /*: Metadata */,
                  was /*: SavedMetadata */
                ) {
              Severity: Minor
              Found in core/prep.js - 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 sortForDescendant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const sortForDescendant = (desc, b, descFirst) => {
                if (areParentChild(deletedPath(desc), createdPath(b))) return descFirst
                if (areParentChild(deletedPath(b), createdPath(desc))) return -descFirst
              
                if (areParentChild(createdPath(b), deletedPath(desc))) return descFirst
              Severity: Minor
              Found in core/remote/change.js - 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  run: (docs /*: SavedMetadata[] */) /*: Promise<SavedMetadata[]> */ => {
                    return Promise.resolve(
                      docs.map(doc => {
                        if (doc.incompatibilities) {
                          if (doc.incompatibilities.length === 1) {
              Severity: Minor
              Found in core/migrations/migrations.js - 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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function find /*:: <T> */(
                changes /*: LocalChange[] */,
                maybeRightType /*: (LocalChange) => ?T */,
                predicate /*: (T) => boolean */,
                remove /*: ?true */
              Severity: Minor
              Found in core/local/chokidar/local_change.js - 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