cozy-labs/cozy-desktop

View on GitHub

Showing 415 of 610 total issues

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

/**
 * @module core/sync
 * @flow
 */

Severity: Major
Found in core/sync/index.js - About 2 days to fix

    Function updateFileAsync has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
    Open

      async updateFileAsync(side /*: SideName */, doc /*: Metadata */) {
        log.debug({ path: doc.path }, 'updateFileAsync')
    
        const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
        if (!file) {
    Severity: Minor
    Found in core/merge.js - About 1 day 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

    File merge.js has 702 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @module core/merge
     * @flow
     */
    
    
    Severity: Major
    Found in core/merge.js - About 1 day to fix

      File local_change.js has 621 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** A local change as to be fed to Prep/Merge.
       *
       * Ended up being specific to ChokidarWatcher.
       *
       * @module core/local/chokidar/local_change
      Severity: Major
      Found in core/local/chokidar/local_change.js - About 1 day to fix

        File metadata.js has 589 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /** Metadata of synchronized files & directories.
         *
         * ### File
         *
         * - `_rev`: from PouchDB
        Severity: Major
        Found in core/metadata.js - About 1 day to fix

          File main.js has 571 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict'
          
          require('../core/globals')
          
          // Initialize `remote` module so that renderer processes can use it.
          Severity: Major
          Found in gui/main.js - About 1 day to fix

            Function syncBatch has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
            Open

              async syncBatch() /*: Promise<void> */ {
                let change /*: Change */ = {}
                while (!this.lifecycle.willStop()) {
                  await this.lifecycle.ready()
            
            
            Severity: Minor
            Found in core/sync/index.js - About 1 day 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 initialDiff has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
            Open

            async function initialDiff(
              channel /*: Channel */,
              out /*: Channel */,
              { config, state } /*: { config: Config, state: InitialDiffState } */
            ) /*: Promise<void> */ {
            Severity: Minor
            Found in core/local/channel_watcher/initial_diff.js - About 1 day 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 debounce has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
            Open

            function debounce(waiting /*: WaitingItem[] */, events /*: ChannelEvent[] */) {
              for (let i = 0; i < events.length; i++) {
                const event = events[i]
            
                if (event.incomplete) {
            Severity: Minor
            Found in core/local/channel_watcher/await_write_finish.js - About 1 day 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

            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 sortForMove has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

              const sortForMove = (move, b, moveFirst) => {
                if (isMove(b)) {
                  if (isDescendant(move) && isDescendant(b)) {
                    if (areParentChild(deletedPath(move), deletedPath(b))) return moveFirst
                    if (areParentChild(deletedPath(b), deletedPath(move))) return -moveFirst
              Severity: Minor
              Found in core/remote/change.js - About 7 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 putFolderAsync has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                async putFolderAsync(side /*: SideName */, doc /*: Metadata */) {
                  log.debug({ path: doc.path }, 'putFolderAsync')
              
                  const folder /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
                  if (!folder) {
              Severity: Minor
              Found in core/merge.js - About 7 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

              File cozy.js has 461 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * @module core/remote/cozy
               * @flow
               */
              
              
              Severity: Minor
              Found in core/remote/cozy.js - About 7 hrs to fix

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

                /**
                 * @module core/pouch
                 * @flow
                 */
                
                
                Severity: Minor
                Found in core/pouch/index.js - About 6 hrs to fix

                  Function Details has 171 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Details = props => {
                    const { translate, interpolate } = props
                  
                    return e('div', { className: 'details' }, [
                      e('header', { className: 'details__header' }, [
                  Severity: Major
                  Found in gui/details.js - About 6 hrs to fix

                    Function applyDoc has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async applyDoc(
                        doc /*: SavedMetadata */,
                        side /*: Writer */
                      ) /*: Promise<*> */ {
                        if (doc.incompatibilities && side.name === 'local') {
                    Severity: Minor
                    Found in core/sync/index.js - About 6 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 wrapError has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const wrapError = (
                      err /*: FetchError |  Error */,
                      doc /*: ?SavedMetadata */
                    ) /*: RemoteError */ => {
                      if (isNetworkError(err)) {
                    Severity: Major
                    Found in core/remote/errors.js - About 5 hrs to fix

                      Function makeComparator has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const makeComparator = (
                        name /*: string */,
                        { attributes } /*: { attributes?: Array<string> } */ = {}
                      ) => {
                        const interestingPaths = attributes && attributes.map(f => f.split('.'))
                      Severity: Minor
                      Found in core/metadata.js - About 5 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 moveFileAsync has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                      const wrapError = (
                        err /*: FetchError |  Error */,
                        doc /*: ?SavedMetadata */
                      ) /*: RemoteError */ => {
                        if (isNetworkError(err)) {
                      Severity: Minor
                      Found in core/remote/errors.js - About 5 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

                      Severity
                      Category
                      Status
                      Source
                      Language