SpeciesFileGroup/taxonworks

View on GitHub
app/assets/javascripts/views/hub/task-filter.js

Summary

Maintainability
B
6 hrs
Test Coverage

File task-filter.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var CarrouselTask = function (sec, rows, columns) {
  // sec = Name of data section, this is for identify div.
  // rows = This is for the number of rows that will be displayed, if this number is less than the number of items, it will activate the navigation controls

  this.children = []
Severity: Minor
Found in app/assets/javascripts/views/hub/task-filter.js - About 3 hrs to fix

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

    CarrouselTask.prototype.showchildren = function (childIndex) {
      var count = 0
    
      if (typeof childIndex !== 'undefined') {
        if (childIndex > this.active.length - this.maxCards) {
    Severity: Minor
    Found in app/assets/javascripts/views/hub/task-filter.js - About 1 hr to fix

      Function showchildren has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      CarrouselTask.prototype.showchildren = function (childIndex) {
        var count = 0
      
        if (typeof childIndex !== 'undefined') {
          if (childIndex > this.active.length - this.maxCards) {
      Severity: Minor
      Found in app/assets/javascripts/views/hub/task-filter.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

      Function handleEvents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      CarrouselTask.prototype.handleEvents = function (that) {
        $(this.sectionTag + ' .navigation').on('click', 'a', function () {
          if ($(this).attr('data-arrow') == 'down') {
            that.arrayTasks.forEach(function (element) {
              if ($(this).attr('data-arrow') == 'down') {
      Severity: Minor
      Found in app/assets/javascripts/views/hub/task-filter.js - About 35 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

      Function checkChildFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      CarrouselTask.prototype.checkChildFilter = function (childTag) {
        let find = 0
        let isTrue = 0
      
        for (let key in this.filters) {
      Severity: Minor
      Found in app/assets/javascripts/views/hub/task-filter.js - About 25 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

      There are no issues that match your filters.

      Category
      Status