onijim/owl-table

View on GitHub

Showing 76 of 76 total issues

File swift-box.js has 1379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * SwiftBox
 * A lightweight combobox plugin for jQuery
 * https://github.com/Knotix/SwiftBox/
 *
Severity: Major
Found in lib/swift-box.js - About 3 days to fix

    Function owlTableService has 384 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function owlTableService ($http, $rootScope, $filter, $modal, owlConstants, owlResource, owlUtils, owlFilter) {
            var unrenderedTable;
    
            var service = {
                tables: [],
    Severity: Major
    Found in src/services/owlTableService.js - About 1 day to fix

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

          render: function () {
              var props = this.props;
              var td;
              var content;
              var optionText;
      Severity: Minor
      Found in react_components/cell.js - About 1 day 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 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 render has 143 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render: function () {
                var self = this;
        
                var props = self.props;
                var tackyTop = false;
        Severity: Major
        Found in react_components/table.js - About 5 hrs to fix

          File owlTableService.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          (function (angular, _, $, React, OwlTableReact) {
              'use strict';
          
              function owlTableService ($http, $rootScope, $filter, $modal, owlConstants, owlResource, owlUtils, owlFilter) {
                  var unrenderedTable;
          Severity: Minor
          Found in src/services/owlTableService.js - About 5 hrs to fix

            Function owlTableDirective has 134 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function owlTableDirective ($timeout, $window, owlTable) {
                    return {
                        restrict: 'EA',
                        scope: {
                            data: '=',
            Severity: Major
            Found in src/directives/owlTable.js - About 5 hrs to fix

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

                  render: function () {
                      var props = this.props;
                      var td;
                      var content;
                      var optionText;
              Severity: Major
              Found in react_components/cell.js - About 4 hrs to fix

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

                        if (self.props.column.type === 'date') {
                            $(self.getDOMNode()).on('changeDate', function (date) {
                                date.target.value = date.format().toUpperCase();
                                self.props.tableDidChange(date, self.props.row, self.props.column);
                                self.transmitSaveEvent(date);
                Severity: Major
                Found in react_components/input.js and 1 other location - About 4 hrs to fix
                react_components/input.js on lines 179..185

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

                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 (self.props.column.type === 'date') {
                            $(self.getDOMNode()).on('changeData', function (date) {
                                date.target.value = date.format().toUpperCase();
                                self.props.tableDidChange(date, self.props.row, self.props.column);
                                self.transmitSaveEvent(date);
                Severity: Major
                Found in react_components/input.js and 1 other location - About 4 hrs to fix
                react_components/input.js on lines 165..171

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

                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 compile has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            compile: function (tElem, tAttrs) {
                
                                return function link (scope, elem, attrs) {
                                    var table;
                                    var rendered;
                Severity: Major
                Found in src/directives/owlTable.js - About 3 hrs to fix

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

                                  return function link (scope, elem, attrs) {
                                      var table;
                                      var rendered;
                                      var container = elem.find('.owl-react-container')[0];
                  
                  
                  Severity: Major
                  Found in src/directives/owlTable.js - About 3 hrs to fix

                    File table.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    function stripFilters (string) {
                        _.forOwn(filterOptions, function (val, key) {
                            var keyRegExp = new RegExp('^' + key);
                            string = string.replace(keyRegExp, '');
                        });
                    Severity: Minor
                    Found in react_components/table.js - About 3 hrs to fix

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

                          render: function () {
                              var props = this.props;
                      
                              var input;
                              var options = props.column.options;
                      Severity: Major
                      Found in react_components/input.js - About 3 hrs to fix

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

                        (function (angular) {
                            'use strict';
                        
                            function owlFilterControls (owlTable) {
                                return {
                        Severity: Major
                        Found in src/directives/owlFilterControls.js and 1 other location - About 3 hrs to fix
                        src/directives/owlPagination.js on lines 1..22

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

                        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

                        (function (angular) {
                            'use strict';
                        
                            function owlPagination (owlTable) {
                                return {
                        Severity: Major
                        Found in src/directives/owlPagination.js and 1 other location - About 3 hrs to fix
                        src/directives/owlFilterControls.js on lines 1..20

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

                        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 setSelectedIndexes has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function setSelectedIndexes(elements, indexes, trigger_change) {
                                elements = normalizeElementArray(elements);
                        
                                if(indexes === undefined || indexes === null) {
                                    indexes = [];
                        Severity: Major
                        Found in lib/swift-box.js - About 3 hrs to fix

                          Function swiftsearch has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function swiftsearch(needle, haystacks, include_non_matches, result_limit) {
                                  haystacks = haystacks || [];
                                  needle    = String(needle || '');
                          
                                  if(!(haystacks instanceof Array)) {
                          Severity: Major
                          Found in lib/swift-search.js - About 3 hrs to fix

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

                            module.exports = function(config) {
                            
                                // Use ENV vars on Travis and sauce.json locally to get credentials
                                if (!process.env.SAUCE_USERNAME) {
                                    if (!fs.existsSync('sauce.json')) {
                            Severity: Major
                            Found in karma.conf-ci.js - About 2 hrs to fix

                              Function normalizeOptionArray has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function normalizeOptionArray(option_array, sort_function, remove_duplicates) {
                                      if(option_array === undefined || option_array === null) {
                                          option_array = [];
                                      }
                              
                              
                              Severity: Major
                              Found in lib/swift-box.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language