cozy-labs/cozy-desktop

View on GitHub

Showing 610 of 610 total issues

Function addRemote has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async addRemote(
    cozyUrl /*: string */,
    syncPath /*: string */,
    deviceName /*: string */
  ) {
Severity: Minor
Found in core/app.js - About 1 hr to fix

    Function sortForMove has 29 lines of code (exceeds 25 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 1 hr to fix

      Function args has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const args = (argv /*: Array<*> */ = process.argv) => {
        const config = yargs
          .env('Change directory exclusions')
          .usage('$0 [--list] [--add <directories>] [--remove <directories>]')
          .options({
      Severity: Minor
      Found in dev/remote/change-dir-exclusions.js - About 1 hr to fix

        Function login has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const login = async (cozyUrl, passphrase) => {
          const { csrf_token, salt, iterations } = await _getLoginInfo(cozyUrl)
          log.debug({ csrf_token }, 'Login...')
          if (!csrf_token) {
            log.debug('Already logged in. Skipping login')
        Severity: Minor
        Found in dev/remote/automated_registration.js - About 1 hr to fix

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

            const fileMove /*: Object */ = build('FileMove', e.path, {
              stats: e.stats,
              old: unlinkChange.old,
              ino: unlinkChange.ino,
              wip: e.wip
          Severity: Major
          Found in core/local/chokidar/local_change.js and 3 other locations - About 1 hr to fix
          core/local/chokidar/local_change.js on lines 435..440
          core/local/chokidar/local_change.js on lines 523..528
          core/local/chokidar/local_change.js on lines 655..660

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

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

            const dirMove /*: Object */ = build('DirMove', e.path, {
              stats: addChange.stats,
              old: addChange.old,
              ino: addChange.ino,
              wip: e.wip
          Severity: Major
          Found in core/local/chokidar/local_change.js and 3 other locations - About 1 hr to fix
          core/local/chokidar/local_change.js on lines 397..402
          core/local/chokidar/local_change.js on lines 435..440
          core/local/chokidar/local_change.js on lines 523..528

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

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

            const dirMove /*: Object */ = build('DirMove', addChange.path, {
              stats: addChange.stats,
              old: e.old,
              ino: addChange.ino,
              wip: addChange.wip
          Severity: Major
          Found in core/local/chokidar/local_change.js and 3 other locations - About 1 hr to fix
          core/local/chokidar/local_change.js on lines 397..402
          core/local/chokidar/local_change.js on lines 435..440
          core/local/chokidar/local_change.js on lines 655..660

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

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

            const dirMove /*: Object */ = build('DirMove', e.path, {
              stats: e.stats,
              old: unlinkChange.old,
              ino: unlinkChange.ino,
              wip: e.wip
          Severity: Major
          Found in core/local/chokidar/local_change.js and 3 other locations - About 1 hr to fix
          core/local/chokidar/local_change.js on lines 397..402
          core/local/chokidar/local_change.js on lines 523..528
          core/local/chokidar/local_change.js on lines 655..660

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

          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

          Function runAndRecordParcelEvents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const runAndRecordParcelEvents = async scenario => {
            const producer = new ParcelProducer({
              config,
              ignore: new Ignore([]),
              events: new EventEmitter()
          Severity: Minor
          Found in dev/capture/local.js - About 1 hr to fix

            Function showWindow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const showWindow = async bounds => {
              if (
                notificationsState.revokedAlertShown ||
                notificationsState.syncDirUnlinkedShown
              )
            Severity: Minor
            Found in gui/main.js - About 1 hr to fix

              Function withDefaultValues has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function withDefaultValues /*:: <T: JsonApiDirAttributes|JsonApiFileAttributes|JsonApiFileVersionAttributes> */(
                attributes /*: T */
              ) /*: T */ {
                if (attributes.type) {
                  if (attributes.type === DIR_TYPE) {
              Severity: Minor
              Found in core/remote/document.js - About 1 hr to fix

                Function separatePendingChanges has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function separatePendingChanges(
                  changes /*: LocalChange[] */,
                  pendingChanges /*: LocalChange[] */
                ) /*: LocalChange[] */ {
                  log.trace('Reserve changes in progress for next flush...')
                Severity: Minor
                Found in core/local/chokidar/analysis.js - About 1 hr to fix

                  Function squashedWithParent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const squashedWithParent = (
                    change,
                    previousChanges /*: RemoteChange[] */,
                    encounteredMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */
                  ) => {
                  Severity: Minor
                  Found in core/remote/watcher/squashMoves.js - About 1 hr to fix

                    Function fileMoveFromUnlinkAdd has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function fileMoveFromUnlinkAdd(
                      sameInodeChange /*: ?LocalChange */,
                      e /*: LocalFileAdded */
                    ) /*: * */ {
                      const unlinkChange /*: ?LocalFileDeletion */ =
                    Severity: Minor
                    Found in core/local/chokidar/local_change.js - About 1 hr to fix

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

                        if (
                          !srcDoc ||
                          srcDoc.path.normalize() === dstEvent.path.normalize() ||
                          srcDoc.ino !== dstEvent.stats.ino
                        )
                      Severity: Major
                      Found in core/local/chokidar/local_change.js and 1 other location - About 1 hr to fix
                      core/local/chokidar/local_change.js on lines 679..684

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

                      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 (
                          !srcDoc ||
                          srcDoc.path.normalize() === dstEvent.path.normalize() ||
                          srcDoc.ino !== dstEvent.stats.ino
                        )
                      Severity: Major
                      Found in core/local/chokidar/local_change.js and 1 other location - About 1 hr to fix
                      core/local/chokidar/local_change.js on lines 614..619

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

                      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

                      Function popoverBounds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const popoverBounds = (
                        wantedWidth,
                        wantedHeight,
                        trayposition,
                        workArea,
                      Severity: Minor
                      Found in gui/js/tray.window.js - About 1 hr 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 sortForAdd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const sortForAdd = (add, b, addFirst) => {
                        if (isRestore(b) || isAdd(b)) {
                          if (areParentChild(createdPath(add), createdPath(b))) return addFirst
                          if (areParentChild(createdPath(b), createdPath(add))) return -addFirst
                      
                      
                      Severity: Minor
                      Found in core/remote/change.js - About 1 hr 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 addFolderAsync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        async addFolderAsync(doc /*: SavedMetadata */) /*: Promise<void> */ {
                          const { path } = doc
                          log.info({ path }, 'Creating folder...')
                      
                          const [parentPath, name] = dirAndName(doc.path)
                      Severity: Minor
                      Found in core/remote/index.js - About 1 hr 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 analyseEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function analyseEvent(
                        e /*: LocalEvent */,
                        previousChanges /*: LocalChangeMap */
                      ) /*: ?LocalChange|true */ {
                        const sameInodeChange = previousChanges.findByInode(getInode(e))
                      Severity: Minor
                      Found in core/local/chokidar/analysis.js - About 1 hr 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