onijim/owl-table

View on GitHub
src/services/owlFilter.js

Summary

Maintainability
D
1 day
Test Coverage

Function owlFilter has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function owlFilter (owlConstants, owlUtils) {
    return {

        hasNoFilters: function (columns) {
            return _.every(columns, function (column) {
Severity: Major
Found in src/services/owlFilter.js - About 5 hrs to fix

    Function filterCell has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            filterCell: function (row, column, termCache, i, filter) {
                var conditionType = typeof filter.condition;
                if (conditionType === 'undefined' || !conditionType) {
                    filter.condition = owlConstants.filtering.CONTAINS;
                }
    Severity: Minor
    Found in src/services/owlFilter.js - About 1 hr to fix

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

              filterTable: function (rows, columns) {
                  var self = this;
      
                  if (!rows) {
                      return;
      Severity: Minor
      Found in src/services/owlFilter.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                    } else if (filter.condition === owlConstants.filtering.CONTAINS) {
                        var containsRE = termCache(cacheId) ? termCache(cacheId) : termCache(cacheId, new RegExp(term, regexpFlags));
        
                        if (!containsRE.test(value)) {
                            return false;
        Severity: Major
        Found in src/services/owlFilter.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if (value.length !== 0) {
                              return false;
                          }
          Severity: Major
          Found in src/services/owlFilter.js - About 45 mins to fix

            Function filterCell has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    filterCell: function (row, column, termCache, i, filter) {
            Severity: Minor
            Found in src/services/owlFilter.js - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return false;
              Severity: Major
              Found in src/services/owlFilter.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return false;
                Severity: Major
                Found in src/services/owlFilter.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return true;
                  Severity: Major
                  Found in src/services/owlFilter.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return false;
                    Severity: Major
                    Found in src/services/owlFilter.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return false;
                      Severity: Major
                      Found in src/services/owlFilter.js - About 30 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status