d4l3k/WebSync

View on GitHub
assets/src/tables.js

Summary

Maintainability
F
6 days
Test Coverage

File tables.js has 848 lines of code (exceeds 250 allowed). Consider refactoring.
Open


/*global $, define, rangy, _, JST*/

//= require templates/tables-ribbon
//= require templates/tables-selection
Severity: Major
Found in assets/src/tables.js - About 2 days to fix

    Function getCellData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getCellData: function(range) {
          var bits = range.split('.');
          var table; // = exports.primaryTable();
          if (bits.length >= 2) {
            var name = bits[0];
    Severity: Major
    Found in assets/src/tables.js - About 2 hrs to fix

      Function updateSelectedArea has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          updateSelectedArea: function() {
            $('.Table.axis th').removeClass('active');
            if (!exports.selected || exports.primaryTable() !== exports.primaryTable(exports.selectionEnd)) {
              $('#table_selection').hide();
              if (exports.selected) {
      Severity: Major
      Found in assets/src/tables.js - About 2 hrs to fix

        Function keypressHandler has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            keypressHandler: function(e) {
              if (!exports.selectedElem) {
                return;
              }
              if (exports.selected) {
        Severity: Minor
        Found in assets/src/tables.js - About 1 hr to fix

          Function cursorSelect has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              cursorSelect: function(td, noanim) {
                $("#ribbon_buttons a:contains('Table')").parent().fadeIn(200);
                // Cleanup last elem.
                if (exports.selectedElem) {
                  exports.selectedEditable(false);
          Severity: Minor
          Found in assets/src/tables.js - About 1 hr to fix

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

              $('.content').delegate('.Table.axis#x th.resize', 'mousedown.Tables', function(e) {
                exports.drag = true;
                if (Math.abs(e.pageX - $(this).offset().left) < 5) {
                  exports.active = $(this).prev()[0];
                } else {
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 6 hrs to fix
            assets/src/tables.js on lines 917..926

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

            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

              $('.content').delegate('.Table.axis#y th.resize', 'mousedown.Tables', function(e) {
                exports.drag = true;
                if (Math.abs(e.pageY - $(this).offset().top) < 5) {
                  exports.active = $(this).prev()[0];
                } else {
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 6 hrs to fix
            assets/src/tables.js on lines 907..916

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

            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

              $('.content').delegate('.Table.axis#y th', 'mousemove.Tables', function(e) {
                var position = $(this).offset();
                $('.Table.axis th.resize').removeClass('resize');
                if (Math.abs(e.pageY - position.top) < 5 || Math.abs(e.pageY - (position.top + $(this).height())) < 5) {
                  $(this).addClass('resize');
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 5 hrs to fix
            assets/src/tables.js on lines 854..860

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

            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

              $('.content').delegate('.Table.axis#x th', 'mousemove.Tables', function(e) {
                var position = $(this).offset();
                $('.Table.axis th.resize').removeClass('resize');
                if (Math.abs(e.pageX - position.left) < 5 || Math.abs(e.pageX - (position.left + $(this).width())) < 5) {
                  $(this).addClass('resize');
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 5 hrs to fix
            assets/src/tables.js on lines 861..867

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

            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

                  for (var i = 0; i < size[1]; i++) {
                    $('<td></td>').insertBefore(exports.selectedElem.parentElement.parentElement.children[i].children[pos[0]]);
                  }
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 1 hr to fix
            assets/src/tables.js on lines 808..810

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

            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

                  for (var i = 0; i < size[1]; i++) {
                    $('<td></td>').insertAfter(exports.selectedElem.parentElement.parentElement.children[i].children[pos[0]]);
                  }
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 1 hr to fix
            assets/src/tables.js on lines 797..799

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

            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

                    bottomRight = [
                      first[0] > second[0] ? first[0] : second[0],
                      first[1] > second[1] ? first[1] : second[1]
                    ];
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 1 hr to fix
            assets/src/tables.js on lines 316..319

            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

                    topLeft = [
                      first[0] < second[0] ? first[0] : second[0],
                      first[1] < second[1] ? first[1] : second[1]
                    ];
            Severity: Major
            Found in assets/src/tables.js and 1 other location - About 1 hr to fix
            assets/src/tables.js on lines 320..323

            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

            There are no issues that match your filters.

            Category
            Status