cozy-labs/cozy-desktop

View on GitHub

Showing 610 of 610 total issues

Function fixPathsAfterParentMove has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fixPathsAfterParentMove(renamedEvents, event) {
  for (const renamedEvent of renamedEvents) {
    if (
      event.oldPath &&
      areParentChildPaths(renamedEvent.oldPath, event.oldPath)
Severity: Minor
Found in core/local/channel_watcher/initial_diff.js - About 1 hr 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

    Consider simplifying this complex logical expression.
    Open

          if (
            c.type === 'FileAddition' ||
            c.type === 'DirAddition' ||
            c.type === 'FileUpdate' ||
            c.type === 'DirUpdate' ||
    Severity: Critical
    Found in core/remote/watcher/normalizePaths.js - About 1 hr to fix

      Function connect has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async connect(
          req /*: http.ClientRequest */,
          opts /*: AgentConnectOpts */
        ) /*: Promise<http.Agent> */ {
          const { secureEndpoint } = opts
      Severity: Minor
      Found in gui/js/network/agent.js - About 1 hr to fix

        Function addFileAsync has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async addFileAsync(
            doc /*: SavedMetadata */,
            onProgress /*: ?ProgressCallback */
          ) /*: Promise<void> */ {
            const { path } = doc
        Severity: Minor
        Found in core/remote/index.js - About 1 hr to fix

          Function onFlush has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async onFlush(rawEvents /*: ChokidarEvent[] */) {
              log.debug(`Flushed ${rawEvents.length} events`)
          
              this.events.emit('buffering-end')
              syncDir.ensureExistsSync(this)
          Severity: Minor
          Found in core/local/chokidar/watcher.js - About 1 hr to fix

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

            module.exports = {
              build,
              spread,
              current,
              after,
            Severity: Major
            Found in core/utils/timestamp.js and 1 other location - About 1 hr to fix
            core/config.js on lines 341..352

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

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

              log.debug(
                {
                  oldpath: moveChange.old && moveChange.old.path,
                  path: moveChange.path,
                  ino: moveChange.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 735..743

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

            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

            function isFolder(
              doc /*: Metadata|MetadataLocalInfo|MetadataRemoteInfo */
            ) /*: boolean %checks */ {
              return doc.docType != null
                ? doc.docType === FOLDER
            Severity: Major
            Found in core/metadata.js and 1 other location - About 1 hr to fix
            core/metadata.js on lines 325..333

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

            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 (json.attributes.type === DIR_TYPE) {
                const remoteDir = ({
                  type: DIR_TYPE,
                  _id: json._id,
                  _rev: json._rev,
            Severity: Major
            Found in core/remote/document.js and 1 other location - About 1 hr to fix
            core/remote/document.js on lines 336..346

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

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

              log.debug(
                {
                  oldpath: dirMove.old && dirMove.old.path,
                  path: dirMove.path,
                  ino: dirMove.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 735..743
            core/local/chokidar/local_change.js on lines 820..828

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

            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 (file.local) {
                        // In this case we can dissociate the remote record from its local
                        // counterpart that was just renamed and will be merged later.
                        metadata.dissociateLocal(file)
                        // We make sure Sync will detect and propagate the remote update
            Severity: Major
            Found in core/merge.js and 1 other location - About 1 hr to fix
            core/merge.js on lines 300..311

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

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

              log.debug(
                {
                  oldpath: fileMove.old && fileMove.old.path,
                  path: fileMove.path,
                  ino: fileMove.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 735..743
            core/local/chokidar/local_change.js on lines 820..828

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

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

              log.debug(
                {
                  oldpath: fileMove.old && fileMove.old.path,
                  path: fileMove.path,
                  ino: fileMove.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 735..743
            core/local/chokidar/local_change.js on lines 820..828

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

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

              log.debug(
                {
                  oldpath: fileMove.old && fileMove.old.path,
                  path: fileMove.path,
                  ino: fileMove.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 735..743
            core/local/chokidar/local_change.js on lines 820..828

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

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

              log.debug(
                {
                  oldpath: moveChange.old && moveChange.old.path,
                  path: moveChange.path,
                  ino: moveChange.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 662..670
            core/local/chokidar/local_change.js on lines 820..828

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

            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

            module.exports = {
              INVALID_CONFIG_ERROR,
              WINDOWS_DATE_MIGRATION_APP_VERSION,
              WINDOWS_DATE_MIGRATION_FLAG,
              InvalidConfigError,
            Severity: Major
            Found in core/config.js and 1 other location - About 1 hr to fix
            core/utils/timestamp.js on lines 11..22

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

            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

              } else {
                const remoteFile = ({
                  type: FILE_TYPE,
                  _id: json._id,
                  _rev: json._rev,
            Severity: Major
            Found in core/remote/document.js and 1 other location - About 1 hr to fix
            core/remote/document.js on lines 326..336

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

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

              log.debug(
                {
                  oldpath: dirMove.old && dirMove.old.path,
                  path: dirMove.path,
                  ino: dirMove.ino,
            Severity: Major
            Found in core/local/chokidar/local_change.js and 6 other locations - About 1 hr to fix
            core/local/chokidar/local_change.js on lines 503..511
            core/local/chokidar/local_change.js on lines 530..538
            core/local/chokidar/local_change.js on lines 563..571
            core/local/chokidar/local_change.js on lines 597..605
            core/local/chokidar/local_change.js on lines 735..743
            core/local/chokidar/local_change.js on lines 820..828

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

            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