deltreey/Dable

View on GitHub

Showing 68 of 68 total issues

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

  if (this.pagerIncludeFirstAndLast) {
    var pageFirst = footer.querySelector('#' + this.id + '_page_first');
    var pageLast = footer.querySelector('#' + this.id + '_page_last');
    pageFirst.innerHTML = '';
    var pageFirstSpan = span.cloneNode(false);
Severity: Major
Found in src/applyBootstrapStyles.js and 1 other location - About 6 hrs to fix
src/applyJqueryUIStyles.js on lines 64..75

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

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 (this.pagerIncludeFirstAndLast) {
    var pageFirst = footer.querySelector('#' + this.id + '_page_first');
    var pageLast = footer.querySelector('#' + this.id + '_page_last');
    pageFirst.innerHTML = '';
    var pageFirstSpan = span.cloneNode(false);
Severity: Major
Found in src/applyJqueryUIStyles.js and 1 other location - About 6 hrs to fix
src/applyBootstrapStyles.js on lines 62..73

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function default has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

export default function(searchBox) {
  if (searchBox.id != this.id + '_search') {
    return false;
  }

Severity: Minor
Found in src/searchFunc.js - About 5 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 default has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

export default function(start, filter, sortColumn, ascending, callback) { //callback if async
  var dable = this;
  if (typeof callback === 'undefined') {
    callback = false;
  }
Severity: Minor
Found in src/asyncRequest.js - About 5 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

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

  for (var i = 0; i < columns.length; ++i) {
    while (tableRows.length < columns[i].length) {
      tableRows.push([]);
    }

Severity: Major
Found in src/setDataAsColumns.js and 1 other location - About 4 hrs to fix
src/setDataAsRows.js on lines 7..15

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

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 < rows.length; ++i) {
    while (tableColumns.length < rows[i].length) {
      tableColumns.push([]);
    }

Severity: Major
Found in src/setDataAsRows.js and 1 other location - About 4 hrs to fix
src/setDataAsColumns.js on lines 7..15

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

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 (sort) {
      if (sort.innerText.charCodeAt(0) == 9660) {
        sort.setAttribute('class', this.sortClass +
          ' ui-icon ui-icon-triangle-1-s');
      } else if (sort.innerText.charCodeAt(0) == 9650) {
Severity: Major
Found in src/applyJqueryUIStyles.js and 1 other location - About 3 hrs to fix
src/applyBootstrapStyles.js on lines 27..37

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

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

    if (sort) {
      if (sort.innerText.charCodeAt(0) == 9660) {
        sort.setAttribute('class', this.sortClass +
          ' glyphicon glyphicon-chevron-down');
      } else if (sort.innerText.charCodeAt(0) == 9650) {
Severity: Major
Found in src/applyBootstrapStyles.js and 1 other location - About 3 hrs to fix
src/applyJqueryUIStyles.js on lines 18..28

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

Function default has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export default function(input) { //Check for existing table
  if (input) {
    if (input.nodeType && input.nodeName.toLowerCase() == 'div') {
      if (input.hasAttribute('id')) {
        this.id = input.getAttribute('id');
Severity: Minor
Found in src/checkForTable.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 default has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function() {
  var ul = document.createElement('ul');
  var li = document.createElement('li');
  var anchor = document.createElement('a');
  var right = ul.cloneNode(false);
Severity: Major
Found in src/buildPager.js - About 3 hrs to fix

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

    export default function(tableDiv) {
      if (this.dableClass) {
        tableDiv.setAttribute('class', this.dableClass);
      }
    
    
    Severity: Major
    Found in src/applyBaseStyles.js - About 2 hrs to fix

      Function default has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function() {
        var ul = document.createElement('ul');
        var li = document.createElement('li');
        var anchor = document.createElement('a');
        var right = ul.cloneNode(false);
      Severity: Minor
      Found in src/buildPager.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 default has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function(columnIndex, ascending, currentRowObjects) {
        var isInt = true;
        var isDate = true;
        var newRowObjects = currentRowObjects.slice(0);
        for (var i = 0; i < currentRowObjects.length; ++i) {
      Severity: Major
      Found in src/baseSort.js - About 2 hrs to fix

        Function default has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function(columnCell) {
          var tag = columnCell.tagName;
          //prevent sorting from some form elements
          if (tag != 'INPUT' && tag != 'BUTTON' && tag != 'SELECT' &&
              tag != 'TEXTAREA') {
        Severity: Minor
        Found in src/sortFunc.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 default has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function(tableDiv) {
          if (!tableDiv) {
            return false;
          }
        
        
        Severity: Major
        Found in src/applyBootstrapStyles.js - About 2 hrs to fix

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

          export default function(tableDiv) {
            if (!tableDiv) {
              return false;
            }
          
          
          Severity: Major
          Found in src/applyJqueryUIStyles.js - About 2 hrs to fix

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

            export default function(start, filter, sortColumn, ascending, callback) { //callback if async
              var dable = this;
              if (typeof callback === 'undefined') {
                callback = false;
              }
            Severity: Major
            Found in src/asyncRequest.js - About 2 hrs to fix

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

                  this.asyncRequest(newStart, this.currentFilter, this.sortColumn, ascending,
                    bind(function(error) {
                      if (error) {throw error;}
                      this.UpdateDisplayedRows(document.getElementById(this.id + '_body'));
                      this.UpdateStyle();
              Severity: Major
              Found in src/goToPage.js and 1 other location - About 2 hrs to fix
              src/lastPage.js on lines 23..28

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

              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

                  this.asyncRequest(newStart, this.currentFilter, this.sortColumn, ascending,
                    bind(function(error) {
                      if (error) {throw error;}
                      this.UpdateDisplayedRows(document.getElementById(this.id + '_body'));
                      this.UpdateStyle();
              Severity: Major
              Found in src/lastPage.js and 1 other location - About 2 hrs to fix
              src/goToPage.js on lines 16..21

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

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function default has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function(body) {
                if (!body) {
                  body = document.getElementById(this.id + '_body');
                  if (!body) {
                    return false;
              Severity: Minor
              Found in src/updateDisplayedRows.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

              Severity
              Category
              Status
              Source
              Language