mar10/fancytree

View on GitHub
src/jquery.fancytree.dnd5.js

Summary

Maintainability
F
6 days
Test Coverage

File jquery.fancytree.dnd5.js has 773 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jquery.fancytree.dnd5.js
 *
 * Drag-and-drop support (native HTML5).
 * (Extension module for jquery.fancytree.js: https://github.com/mar10/fancytree/)
Severity: Major
Found in src/jquery.fancytree.dnd5.js - About 1 day to fix

    Function onDropEvent has 222 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function onDropEvent(event) {
            var json,
                allowAutoExpand,
                nodeData,
                isSourceFtNode,
    Severity: Major
    Found in src/jquery.fancytree.dnd5.js - About 1 day to fix

      Function handleDragOver has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function handleDragOver(event, data) {
              // Implement auto-scrolling
              if (data.options.dnd5.scroll) {
                  autoScroll(data.tree, event);
              }
      Severity: Major
      Found in src/jquery.fancytree.dnd5.js - About 5 hrs to fix

        Function onDragEvent has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function onDragEvent(event) {
                var json,
                    tree = this,
                    dndOpts = tree.options.dnd5,
                    node = FT.getNode(event),
        Severity: Major
        Found in src/jquery.fancytree.dnd5.js - About 3 hrs to fix

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

                  treeInit: function (ctx) {
                      var $temp,
                          tree = ctx.tree,
                          opts = ctx.options,
                          glyph = opts.glyph || null,
          Severity: Major
          Found in src/jquery.fancytree.dnd5.js - About 2 hrs to fix

            Function autoScroll has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function autoScroll(tree, event) {
                    var spOfs,
                        scrollTop,
                        delta,
                        dndOpts = tree.options.dnd5,
            Severity: Minor
            Found in src/jquery.fancytree.dnd5.js - About 1 hr to fix

              Function evalEffectModifiers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function evalEffectModifiers(tree, event, effectDefault) {
                      var res = effectDefault;
              
                      if (isMac) {
                          if (event.metaKey && event.altKey) {
              Severity: Minor
              Found in src/jquery.fancytree.dnd5.js - About 1 hr to fix

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

                    function applyDropEffectCallback(event, data, allowDrop) {
                        var tree = data.tree,
                            dataTransfer = data.dataTransfer;
                
                        if (
                Severity: Minor
                Found in src/jquery.fancytree.dnd5.js - About 1 hr to fix

                  Function normalizeDragEnterResponse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function normalizeDragEnterResponse(r) {
                          var res;
                  
                          if (!r) {
                              return false;
                  Severity: Minor
                  Found in src/jquery.fancytree.dnd5.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (hitMode === "after" || hitMode === "before" || hitMode === "over") {
                                markerOffsetX = dndOpts.dropMarkerOffsetX || 0;
                                switch (hitMode) {
                                    case "before":
                                        markerAt = "top";
                    Severity: Major
                    Found in src/jquery.fancytree.dnd5.js - About 40 mins to fix

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

                      (function (factory) {
                          if (typeof define === "function" && define.amd) {
                              // AMD. Register as an anonymous module.
                              define(["jquery", "./jquery.fancytree"], factory);
                          } else if (typeof module === "object" && module.exports) {
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 15 other locations - About 3 hrs to fix
                      src/jquery.fancytree.childcounter.js on lines 31..241
                      src/jquery.fancytree.clones.js on lines 16..514
                      src/jquery.fancytree.columnview.js on lines 16..205
                      src/jquery.fancytree.edit.js on lines 16..403
                      src/jquery.fancytree.filter.js on lines 16..549
                      src/jquery.fancytree.glyph.js on lines 16..354
                      src/jquery.fancytree.grid.js on lines 16..1014
                      src/jquery.fancytree.js on lines 18..7378
                      src/jquery.fancytree.logger.js on lines 16..309
                      src/jquery.fancytree.menu.js on lines 18..185
                      src/jquery.fancytree.multi.js on lines 16..128
                      src/jquery.fancytree.persist.js on lines 18..513
                      src/jquery.fancytree.table.js on lines 16..545
                      src/jquery.fancytree.themeroller.js on lines 18..125
                      src/jquery.fancytree.wide.js on lines 15..257

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

                      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

                              } else if (Array.isArray(r)) {
                                  res = {
                                      over: $.inArray("over", r) >= 0,
                                      before: $.inArray("before", r) >= 0,
                                      after: $.inArray("after", r) >= 0,
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd.js on lines 624..637

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

                      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

                                  } else if (event.ctrlKey) {
                                      // Chrome on Mac: [Control]
                                      res = "link";
                                  } else if (event.metaKey) {
                                      // Mac: [Command]
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd5.js on lines 234..243

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

                      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 (event.ctrlKey) {
                                      // Windows: [Ctrl]
                                      res = "copy";
                                  } else if (event.shiftKey) {
                                      // Windows: [Shift]
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd5.js on lines 223..232

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

                      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

                                  res = {
                                      over: $.inArray("over", r) >= 0,
                                      before: $.inArray("before", r) >= 0,
                                      after: $.inArray("after", r) >= 0,
                                  };
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd.js on lines 626..630

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

                      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

                                  switch (hitMode) {
                                      case "before":
                                          markerAt = "top";
                                          markerOffsetX += dndOpts.dropMarkerInsertOffsetX || 0;
                                          break;
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd.js on lines 457..466

                      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

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

                                      if (!node) {
                                          tree.debug(
                                              "Ignore non-node " +
                                                  event.type +
                                                  ": " +
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd5.js on lines 878..888

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

                      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 (!node) {
                                          tree.debug(
                                              "Ignore non-node " +
                                                  event.type +
                                                  ": " +
                      Severity: Major
                      Found in src/jquery.fancytree.dnd5.js and 1 other location - About 1 hr to fix
                      src/jquery.fancytree.dnd5.js on lines 827..837

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

                      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