cozy-labs/cozy-desktop

View on GitHub
core/local/chokidar/analysis.js

Summary

Maintainability
F
1 wk
Test Coverage

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 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 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 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 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 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 defaultSorter has 55 lines of code (exceeds 25 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: Major
      Found in core/local/chokidar/analysis.js - About 2 hrs to fix

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

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

            Function initialScanSorter has 31 lines of code (exceeds 25 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 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 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

                Function separatePendingChanges has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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

                Avoid deeply nested control flow statements.
                Open

                          if (b.type === 'FileMove' && b.update) {
                            changes.push({
                              sideName: 'local',
                              type: 'FileUpdate',
                              path: b.update.path,
                Severity: Major
                Found in core/local/chokidar/analysis.js - About 45 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return bFirst
                  Severity: Major
                  Found in core/local/chokidar/analysis.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      if (localChange.isChildUpdate(a, b)) return aFirst
                    Severity: Major
                    Found in core/local/chokidar/analysis.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return bFirst
                      Severity: Major
                      Found in core/local/chokidar/analysis.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return aFirst
                        Severity: Major
                        Found in core/local/chokidar/analysis.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return aFirst
                          Severity: Major
                          Found in core/local/chokidar/analysis.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              return bFirst
                            Severity: Major
                            Found in core/local/chokidar/analysis.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return aFirst
                              Severity: Major
                              Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  if (localChange.isChildAdd(b, a)) return bFirst
                                Severity: Major
                                Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return bFirst
                                  Severity: Major
                                  Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                      if (localChange.isChildDelete(b, a)) return aFirst
                                    Severity: Major
                                    Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                          return bFirst
                                      Severity: Major
                                      Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            return aFirst
                                        Severity: Major
                                        Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              return bFirst
                                          Severity: Major
                                          Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                  return 1
                                            Severity: Major
                                            Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                  return aFirst
                                              Severity: Major
                                              Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                    return aFirst
                                                Severity: Major
                                                Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                    if (localChange.isChildAdd(a, b)) return aFirst
                                                  Severity: Major
                                                  Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                        return aFirst
                                                    Severity: Major
                                                    Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                          return bFirst
                                                      Severity: Major
                                                      Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                            return aFirst
                                                        Severity: Major
                                                        Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                              return aFirst
                                                          Severity: Major
                                                          Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                              return bFirst
                                                            Severity: Major
                                                            Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                if (localChange.isChildUpdate(b, a)) return bFirst
                                                              Severity: Major
                                                              Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                    return aFirst
                                                                Severity: Major
                                                                Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                      return aFirst
                                                                  Severity: Major
                                                                  Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                        return bFirst
                                                                    Severity: Major
                                                                    Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                          return bFirst
                                                                      Severity: Major
                                                                      Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return bFirst
                                                                        Severity: Major
                                                                        Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                              return aFirst
                                                                          Severity: Major
                                                                          Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                              if (localChange.isChildDelete(a, b)) return bFirst
                                                                            Severity: Major
                                                                            Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                  return bFirst
                                                                              Severity: Major
                                                                              Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                    return bFirst
                                                                                Severity: Major
                                                                                Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                      return aFirst
                                                                                  Severity: Major
                                                                                  Found in core/local/chokidar/analysis.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                          return 0
                                                                                    Severity: Major
                                                                                    Found in core/local/chokidar/analysis.js - About 30 mins to fix

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

                                                                                          case 'unlinkDir':
                                                                                            {
                                                                                              const moveChange /*: ?LocalDirMove */ =
                                                                                                localChange.maybeMoveFolder(sameInodeChange)
                                                                                              if (moveChange && !moveChange.wip) {
                                                                                      Severity: Major
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 5 hrs to fix
                                                                                      core/local/chokidar/analysis.js on lines 222..244

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

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

                                                                                          case 'unlink':
                                                                                            {
                                                                                              const moveChange /*: ?LocalFileMove */ =
                                                                                                localChange.maybeMoveFile(sameInodeChange)
                                                                                              if (moveChange && !moveChange.wip) {
                                                                                      Severity: Major
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 5 hrs to fix
                                                                                      core/local/chokidar/analysis.js on lines 245..267

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

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

                                                                                            if (e.type === 'unlinkDir' && e.old && e.old.docType === metadata.FILE) {
                                                                                              log.warn(
                                                                                                { event: e, old: e.old, path: e.path },
                                                                                                'chokidar miscategorized event (was file, event unlinkDir)'
                                                                                              )
                                                                                      Severity: Major
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 1 hr to fix
                                                                                      core/local/chokidar/analysis.js on lines 163..170

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

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

                                                                                            if (e.type === 'unlink' && e.old && e.old.docType === metadata.FOLDER) {
                                                                                              log.warn(
                                                                                                { event: e, old: e.old, path: e.path },
                                                                                                'chokidar miscategorized event (was folder, event unlink)'
                                                                                              )
                                                                                      Severity: Major
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 1 hr to fix
                                                                                      core/local/chokidar/analysis.js on lines 154..161

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

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

                                                                                        if (
                                                                                          (b.type === 'FileDeletion' || b.type === 'DirDeletion') &&
                                                                                          a.type !== 'FileDeletion' &&
                                                                                          a.type !== 'DirDeletion'
                                                                                        )
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 50 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 440..445

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

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

                                                                                        if (
                                                                                          (a.type === 'FileDeletion' || a.type === 'DirDeletion') &&
                                                                                          b.type !== 'FileDeletion' &&
                                                                                          b.type !== 'DirDeletion'
                                                                                        )
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 50 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 446..451

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

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

                                                                                        if (
                                                                                          !localChange.addPath(a) &&
                                                                                          localChange.childOf(localChange.addPath(b), localChange.delPath(a))
                                                                                        )
                                                                                          return aFirst
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 45 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 474..478

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

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

                                                                                        if (
                                                                                          !localChange.addPath(b) &&
                                                                                          localChange.childOf(localChange.addPath(a), localChange.delPath(b))
                                                                                        )
                                                                                          return bFirst
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 45 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 480..484

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

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

                                                                                              localChange.includeChangeEventIntoFileMove(sameInodeChange, e) ||
                                                                                              localChange.fileMoveFromFileDeletionChange(sameInodeChange, e) ||
                                                                                              localChange.fileMoveIdentical(sameInodeChange, e) ||
                                                                                              localChange.fileUpdate(e)
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 40 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 199..202

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

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

                                                                                              localChange.includeAddEventInFileMove(sameInodeChange, e) ||
                                                                                              localChange.fileMoveFromUnlinkAdd(sameInodeChange, e) ||
                                                                                              localChange.fileRenamingCaseOnlyFromAddAdd(sameInodeChange, e) ||
                                                                                              localChange.fileMoveIdenticalOffline(e) ||
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 40 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 217..220

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

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

                                                                                        if (
                                                                                          localChange.delPath(a) &&
                                                                                          localChange.samePath(localChange.delPath(a), localChange.delPath(b))
                                                                                        )
                                                                                          return bFirst
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 40 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 509..513

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

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

                                                                                        if (
                                                                                          localChange.addPath(a) &&
                                                                                          localChange.samePath(localChange.addPath(a), localChange.addPath(b))
                                                                                        )
                                                                                          return aFirst
                                                                                      Severity: Minor
                                                                                      Found in core/local/chokidar/analysis.js and 1 other location - About 40 mins to fix
                                                                                      core/local/chokidar/analysis.js on lines 515..519

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

                                                                                      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

                                                                                      There are no issues that match your filters.

                                                                                      Category
                                                                                      Status