cozy-labs/cozy-desktop

View on GitHub

Showing 415 of 610 total issues

Function emit has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  emit(name /*: string */, ...args /*: any[] */) /*: boolean */ {
    switch (name) {
      case 'online':
        this.update({ offline: false })
        break
Severity: Major
Found in core/syncstate.js - About 2 hrs to fix

    Function onRegisterRemote has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async onRegisterRemote(
        event /*: ElectronEvent */,
        arg /*: { cozyUrl: string, location: string } */
      ) {
        const syncSession = session.fromPartition(SESSION_PARTITION_NAME)
    Severity: Major
    Found in gui/js/onboarding.window.js - About 2 hrs to fix

      Function start has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        start() {
          log.debug('Starting...')
      
          this.resetInitialScanParams()
      
      
      Severity: Major
      Found in core/local/chokidar/watcher.js - About 2 hrs to fix

        Remote has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Remote /*:: implements Reader, Writer */ {
          /*::
          name: SideName
          other: Reader & Writer
          config: Config
        Severity: Minor
        Found in core/remote/index.js - About 2 hrs to fix

          Function apply has a Cognitive Complexity of 19 (exceeds 5 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: 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 setupProxy has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const setupProxy = async (
            electronApp /*: App */,
            networkConfig /*: Object */,
            session /*: Session */
          ) => {
          Severity: Major
          Found in gui/js/network/index.js - About 2 hrs to fix

            Function moveFolderAsync has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async moveFolderAsync(
                side /*: SideName */,
                doc /*: Metadata */,
                was /*: SavedMetadata */,
                newRemoteRevs /*: ?RemoteRevisionsByID */
            Severity: Major
            Found in core/merge.js - About 2 hrs to fix

              Function constructor has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(...opts /*: { app: ElectronApp, desktop: CoreApp } */) {
                  super(...opts)
              
                  autoUpdater.logger = log
                  autoUpdater.autoDownload = false
              Severity: Major
              Found in gui/js/updater.window.js - About 2 hrs to fix

                Function moveFolderRecursivelyAsync has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async moveFolderRecursivelyAsync(
                    side /*: SideName */,
                    folder /*: Metadata  */,
                    was /*: SavedMetadata */,
                    newRemoteRevs /*: ?RemoteRevisionsByID */
                Severity: Major
                Found in core/merge.js - About 2 hrs to fix

                  Function createInitialTree has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const createInitialTree = async function (
                    scenario /*: * */,
                    cozy /*: * */,
                    pouch /*: Pouch */
                  ) {
                  Severity: Major
                  Found in dev/capture/remote.js - About 2 hrs to fix

                    Function putFolderRecursivelyAsync has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async putFolderRecursivelyAsync(
                        side /*: SideName */,
                        folder /*: Metadata  */,
                        was /*: SavedMetadata */
                      ) {
                    Severity: Minor
                    Found in core/merge.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 initialScanSorter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const initialScanSorter = (a /*: LocalChange */, b /*: LocalChange */) => {
                      if (a.wip && !b.wip) return aFirst
                      if (b.wip && !a.wip) return bFirst
                    
                      if (localChange.isChildAdd(a, b)) return aFirst
                    Severity: Minor
                    Found in core/local/chokidar/analysis.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 trashFileAsync has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async trashFileAsync(
                        side /*: SideName */,
                        trashed /*: SavedMetadata */,
                        doc /*: Metadata */
                      ) /*: Promise<void> */ {
                    Severity: Minor
                    Found in core/merge.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 analyseEvents has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function analyseEvents(
                      events /*: LocalEvent[] */,
                      pendingChanges /*: LocalChange[] */
                    ) /*: LocalChange[] */ {
                      const stopMeasure = measureTime('LocalWatcher#analyseEvents')
                    Severity: Minor
                    Found in core/local/chokidar/analysis.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 deleteFolderAsync has 60 lines of code (exceeds 25 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: Major
                    Found in core/merge.js - About 2 hrs to fix

                      RemoteWatcher has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class RemoteWatcher {
                        /*::
                        config: Config
                        pouch: Pouch
                        prep: Prep
                      Severity: Minor
                      Found in core/remote/watcher/index.js - About 2 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (attributes.type === DIR_TYPE) {
                              return {
                                ...attributes,
                                dir_id: attributes.dir_id || '',
                                name: attributes.name || '',
                        Severity: Critical
                        Found in core/remote/document.js - About 2 hrs to fix

                          Function _withDomainErrors has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async _withDomainErrors /*:: <T: FullRemoteFile|RemoteDir> */(
                              data /*: Readable */,
                              options /*: Object */,
                              fn /*: () => Promise<T> */
                            ) /*: Promise<T> */ {
                          Severity: Major
                          Found in core/remote/cozy.js - About 2 hrs to fix

                            Function default has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            exports.default = async function (configuration) {
                              const { execSync } = require('child_process')
                            
                              const whoami = 'customSign.js'
                            
                            
                            Severity: Major
                            Found in build/windows/customSign.js - About 2 hrs to fix

                              Function getNextChanges has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async getNextChanges(seq /*: number */) /*: Promise<Change[]> */ {
                                  const stopMeasure = measureTime('Sync#getNextChanges')
                                  const opts = {
                                    ...this.baseChangeOptions(seq),
                                    include_docs: true,
                              Severity: Major
                              Found in core/sync/index.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language