cozy-labs/cozy-desktop

View on GitHub

Showing 415 of 610 total issues

Function syncBatch has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async syncBatch() /*: Promise<void> */ {
    let change /*: Change */ = {}
    while (!this.lifecycle.willStop()) {
      await this.lifecycle.ready()

Severity: Major
Found in core/sync/index.js - About 5 hrs to fix

    Pouch has 39 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Pouch {
      /*::
      config: Config
      db: PouchDB
      updater: any
    Severity: Minor
    Found in core/pouch/index.js - About 5 hrs to fix

      File analysis.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** Turn messy low-level events into normalized high-level ones.
       *
       * ## Input
       *
       * The analysis receives
      Severity: Minor
      Found in core/local/chokidar/analysis.js - About 5 hrs to fix

        Function updateFileAsync has 128 lines of code (exceeds 25 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: Major
        Found in core/merge.js - About 5 hrs to fix

          Function moveFolderRecursivelyAsync has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

            async moveFolderRecursivelyAsync(
              side /*: SideName */,
              folder /*: Metadata  */,
              was /*: SavedMetadata */,
              newRemoteRevs /*: ?RemoteRevisionsByID */
          Severity: Minor
          Found in core/merge.js - About 4 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 compareChanges has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

          const compareChanges = (
            { operation: opA, doc: docA } /*: Change */,
            { operation: opB, doc: docB } /*: Change */
          ) => {
            // Operations on different sides don't have dependencies for now. This will
          Severity: Minor
          Found in core/sync/index.js - About 4 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

          RemoteCozy has 37 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RemoteCozy {
            /*::
            config: Config
            url: string
            client: OldCozyClient
          Severity: Minor
          Found in core/remote/cozy.js - About 4 hrs to fix

            Function addFile has 120 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              addFile(
                doc /*: SavedMetadata */,
                onProgress /*: ?ProgressCallback */,
                callback /*: Callback */
              ) /*: void */ {
            Severity: Major
            Found in core/local/index.js - About 4 hrs to fix

              Function ipcEvents has 119 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                ipcEvents() {
                  return {
                    confirm: async (
                      event /*: ElectronEvent */,
                      {
              Severity: Major
              Found in gui/js/tray.window.js - About 4 hrs to fix

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

                /** The remote side read/write interface.
                 *
                 * @module core/remote
                 * @flow
                 */
                Severity: Minor
                Found in core/remote/index.js - About 4 hrs 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

                    File migrations.js has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /**
                     * @module core/migrations/migrations
                     * @flow
                     */
                    
                    
                    Severity: Minor
                    Found in core/migrations/migrations.js - About 4 hrs to fix

                      Function moveFolderAsync has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                        async moveFolderAsync(
                          side /*: SideName */,
                          doc /*: Metadata */,
                          was /*: SavedMetadata */,
                          newRemoteRevs /*: ?RemoteRevisionsByID */
                      Severity: Minor
                      Found in core/merge.js - About 4 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 runActions has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const runActions = (scenario /*: * */, cozy /*: * */) => {
                        debug('[actions]')
                        return Promise.each(scenario.actions, async action => {
                          const now = new Date().toISOString()
                      
                      
                      Severity: Major
                      Found in dev/capture/remote.js - About 4 hrs to fix

                        File errors.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          Config has 30 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Config {
                            /*::
                            configPath: string
                            dbPath: string
                            fileConfig: FileConfig
                          Severity: Minor
                          Found in core/config.js - About 3 hrs to fix

                            Function defaultSorter has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const defaultSorter = (a /*: LocalChange */, b /*: LocalChange */) => {
                              if (a.wip && !b.wip) return aFirst
                              if (b.wip && !a.wip) return bFirst
                            
                              // b is deleting something which is a children of what a adds
                            Severity: Minor
                            Found in core/local/chokidar/analysis.js - About 3 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 updateState has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const updateState = async ({ newState, data }) => {
                              const { status, filename, userAlerts, errors } = data || {}
                            
                              if (newState === 'sync-state') {
                                if (status === 'uptodate') tray.setStatus('online')
                            Severity: Minor
                            Found in gui/main.js - About 3 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 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 applyDoc has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async applyDoc(
                                  doc /*: SavedMetadata */,
                                  side /*: Writer */
                                ) /*: Promise<*> */ {
                                  if (doc.incompatibilities && side.name === 'local') {
                              Severity: Major
                              Found in core/sync/index.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language