cozy-labs/cozy-desktop

View on GitHub

Showing 415 of 610 total issues

Function buildAppMenu has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.buildAppMenu = app => {
  const template = [
    {
      label: translate('AppMenu Edit'),
      submenu: [
Severity: Major
Found in gui/js/appmenu.js - About 3 hrs to fix

    Function blockSyncFor has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      blockSyncFor(
        cause
        /*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */
      ) {
        log.debug(cause, 'blocking sync for error')
    Severity: Major
    Found in core/sync/index.js - About 3 hrs to fix

      Function deleteFolderAsync has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

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

      File app.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** Entry point of the synchronization core.
       *
       * @module core/app
       * @flow
       */
      Severity: Minor
      Found in core/app.js - About 3 hrs to fix

        File tray.window.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* @flow */
        
        const electron = require('electron')
        const { dialog, shell } = electron
        const path = require('path')
        Severity: Minor
        Found in gui/js/tray.window.js - About 3 hrs to fix

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

          /** The Local side read/write interface.
           *
           * @module core/local
           * @flow
           */
          Severity: Minor
          Found in core/local/index.js - About 3 hrs to fix

            Function step has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function step(
              state /*: { incompletes: IncompleteItem[] } */,
              opts /*: IncompleteFixerOptions */
            ) {
              return async (events /*: ChannelBatch */) /*: Promise<ChannelBatch> */ => {
            Severity: Major
            Found in core/local/channel_watcher/incomplete_fixer.js - About 3 hrs to fix

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

                Sync has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Sync {
                  /*::
                  changes: any
                  events: EventEmitter
                  ignore: Ignore
                Severity: Minor
                Found in core/sync/index.js - About 3 hrs to fix

                  Function runActions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const runActions = (scenario /*: * */, cozy /*: * */) => {
                    debug('[actions]')
                    return Promise.each(scenario.actions, async action => {
                      const now = new Date().toISOString()
                  
                  
                  Severity: Minor
                  Found in dev/capture/remote.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 squashMoves has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function squashMoves(changes /*: LocalChange[] */) {
                    log.trace('Squash moves...')
                    const stopMeasure = measureTime('LocalWatcher#squashMoves')
                  
                    for (let i = 0; i < changes.length; i++) {
                  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 debounce has a Cognitive Complexity of 22 (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) {
                        continue
                  Severity: Minor
                  Found in core/local/channel_watcher/initial_diff.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 create has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    create() {
                      this.log.debug('create')
                      const opts = {
                        indexPath: path.resolve(__dirname, '..', 'index.html'),
                        ...this.windowOptions()
                  Severity: Major
                  Found in gui/js/window_manager.js - About 3 hrs to fix

                    Function setup has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function setup(clientInfos /*: ClientInfo */) {
                      if (CI || COZY_NO_SENTRY || isSentryConfigured) {
                        log.info(
                          { COZY_NO_SENTRY, isSentryConfigured },
                          'skipping Sentry configuration'
                    Severity: Major
                    Found in core/utils/sentry.js - About 3 hrs to fix

                      Function analyseEvent has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function analyseEvent(
                        e /*: LocalEvent */,
                        previousChanges /*: LocalChangeMap */
                      ) /*: ?LocalChange|true */ {
                        const sameInodeChange = previousChanges.findByInode(getInode(e))
                      Severity: Major
                      Found in core/local/chokidar/analysis.js - About 2 hrs to fix

                        Function moveFileAsync has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async moveFileAsync(
                            side /*: SideName */,
                            doc /*: Metadata */,
                            was /*: SavedMetadata */
                          ) /*: Promise<*> */ {
                        Severity: Major
                        Found in core/merge.js - About 2 hrs to fix

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

                          const createInitialTree = async function (
                            scenario /*: * */,
                            cozy /*: * */,
                            pouch /*: Pouch */
                          ) {
                          Severity: Minor
                          Found in dev/capture/remote.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 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 emitStatus has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                            emitStatus() {
                              const {
                                offline,
                                remaining,
                                buffering,
                          Severity: Minor
                          Found in core/syncstate.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 detectOperation has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const detectOperation = async (
                            change /*: PouchDBFeedData */,
                            sync /*: Sync */
                          ) /*: Promise<SyncOperation> */ => {
                            const outdatedSide = sync.selectSide(change)
                          Severity: Minor
                          Found in core/sync/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

                          Severity
                          Category
                          Status
                          Source
                          Language