onijim/owl-table

View on GitHub

Showing 54 of 76 total issues

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

    render: function () {
        var self = this;

        var props = self.props;
        var tackyTop = false;
Severity: Minor
Found in react_components/table.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 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 owlExportControls has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function owlExportControls (owlTable) {
            return {
                restrict: 'EA',
                require: '^owlTable',
                templateUrl: 'partials/export.html',
    Severity: Minor
    Found in src/directives/owlExportControls.js - About 1 hr to fix

      Function link has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function link (scope, elem, attrs, tableCtrl) {
                  elem.on('click', function () {
                      elem.tooltip({
                          title: 'Please wait...',
                          trigger: 'manual',
      Severity: Minor
      Found in src/directives/owlPrint.js - About 1 hr to fix

        Function positionOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function positionOptions() {
                var bounding_rectangle = active_select.getBoundingClientRect();
                var window_width       = window.innerWidth;
                var window_height      = window.innerHeight;
        
        
        Severity: Minor
        Found in lib/swift-box.js - About 1 hr to fix

          Function render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render: function () {
                  var props = this.props;
                  var state = this.state;
          
                  var handler = this.clickHandler;
          Severity: Minor
          Found in react_components/row.js - About 1 hr to fix

            Function showOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function showOptions(element) {
                    element = normalizeElementArray(element)[0];
            
                    // If the element is already active, we're done
                    if(active_select === element) {
            Severity: Minor
            Found in lib/swift-box.js - About 1 hr to fix

              Function calculateWidth has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function calculateWidth(element, option_array) {
                      element = normalizeElementArray(element)[0];
              
                      if(!element || !option_array || !option_array.length) {
                          return 0;
              Severity: Minor
              Found in lib/swift-box.js - About 1 hr to fix

                Function sortSearchResults has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function sortSearchResults(a, b) {
                        var tmp_a;
                        var tmp_b;
                
                        tmp_a = -a.longest_match;
                Severity: Minor
                Found in lib/swift-search.js - About 1 hr to fix

                  Function initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          service.initialize = function (settings) {
                              //this.data = settings.data;
                              this.columns = settings.columns;
                              this.childColumns = settings.childColumns;
                              this.options = _.defaults(settings.options, defaults.options);
                  Severity: Minor
                  Found in src/services/owlTableService.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

                      Function owlSpinner has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function owlSpinner(owlTable) {
                              function link (scope, elem, attrs, tableCtrl) {
                                  var opts = {
                                      lines: 13, // The number of lines to draw
                                      length: 20, // The length of each line
                      Severity: Minor
                      Found in src/directives/owlSpinner.js - About 1 hr to fix

                        Function owlResource has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function owlResource ($http, owlUtils) {
                        
                                return function (options) {
                        
                                    var saveUrl = '';
                        Severity: Minor
                        Found in src/services/owlResource.js - About 1 hr to fix

                          Function initializeTacky has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function initializeTacky() {
                                  // Initialize the jQuery plugin
                                  if($) {
                                      $.fn.tacky = function() {
                                          return tacky(this);
                          Severity: Minor
                          Found in lib/tacky.js - About 1 hr to fix

                            Function setValues has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function setValues(elements, values, trigger_change) {
                                    elements = normalizeElementArray(elements);
                            
                                    if(!(values instanceof Array)) {
                                        values = [values];
                            Severity: Minor
                            Found in lib/swift-box.js - About 1 hr to fix

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

                                      service.customizeColumns = function () {
                                          var self = this;
                              
                                          var modal = $modal.open({
                                              templateUrl: 'partials/columnModal.html',
                              Severity: Minor
                              Found in src/services/owlTableService.js - About 1 hr to fix

                                Function selectAll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function selectAll(elements, filtered) {
                                        elements = normalizeElementArray(elements);
                                
                                        for(var i = 0; i < elements.length; ++i) {
                                            var element = elements[i];
                                Severity: Minor
                                Found in lib/swift-box.js - About 1 hr to fix

                                  Function controller has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                              controller: ['$scope', function ($scope) {
                                                  this.csvHeader = function () {
                                                      return $scope.columns.map(function (column) {
                                                          return column.title;
                                                      });
                                  Severity: Minor
                                  Found in src/directives/owlExportControls.js - About 1 hr to fix

                                    Function renderOptions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function renderOptions(scroll_top) {
                                            // Hide all options initially
                                            $option_elements.addClass('swift-box-hidden');
                                    
                                            // If there are no options, we're done
                                    Severity: Minor
                                    Found in lib/swift-box.js - About 1 hr to fix

                                      Function filterOptions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          function filterOptions(filter_text) {
                                              // Normalize the filter text
                                              if(filter_text === undefined || filter_text === null) {
                                                  filter_text = '';
                                              }
                                      Severity: Minor
                                      Found in lib/swift-box.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language