onijim/owl-table

View on GitHub

Showing 54 of 76 total issues

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

    function setOptionHash(elements, hash) {
        elements = normalizeElementArray(elements);
        var option_array = option_arrays[hash];

        if(hash === undefined || hash === null) {
Severity: Minor
Found in lib/swift-box.js - About 1 hr to fix

    Function exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(config) {
        config.set({
    
            // base path that will be used to resolve all patterns (eg. files, exclude)
            basePath: '.',
    Severity: Minor
    Found in karma.conf.js - About 1 hr to fix

      Function owlTableService has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function owlTableService ($http, $rootScope, $filter, $modal, owlConstants, owlResource, owlUtils, owlFilter) {
      Severity: Major
      Found in src/services/owlTableService.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(tmp_a === tmp_b) {
                                      tmp_a = a.index;
                                      tmp_b = b.index;
          
                                      if(tmp_a === tmp_b) {
          Severity: Major
          Found in lib/swift-search.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

              Avoid deeply nested control flow statements.
              Open

                                      if(new_indexes[j] !== selected_indexes[j]) {
                                          changed = true;
                                          break;
                                      }
              Severity: Major
              Found in lib/swift-box.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

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

                                tableDidChange: function (event, row, column) {
                                    if (typeof this.state.changedData[row.id] === 'undefined') {
                                        this.state.changedData[row.id] = {};
                                    }
                            
                            
                            Severity: Minor
                            Found in react_components/table.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

                            Severity
                            Category
                            Status
                            Source
                            Language