onijim/owl-table

View on GitHub

Showing 76 of 76 total issues

Function componentDidMount has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    componentDidMount: function () {
        var self = this;

        var filterList = document.createElement('div');
        filterList.className = 'owl-filter-list';
Severity: Major
Found in react_components/table.js - About 2 hrs to fix

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

        render: function () {
            var props = this.props;
    
            var input;
            var options = props.column.options;
    Severity: Minor
    Found in react_components/input.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 swiftbox has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function swiftbox(elements, config) {
            elements = normalizeElementArray(elements);
    
            var new_elements = [];
    
    
    Severity: Major
    Found in lib/swift-box.js - About 2 hrs to fix

      Function owlPrintDirective has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function owlPrintDirective($window, owlTable, $timeout) {
              var printSection = document.getElementById('owlPrintSection');
      
              if (!printSection) {
                  printSection = document.createElement('div');
      Severity: Major
      Found in src/directives/owlPrint.js - About 2 hrs to fix

        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

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

                    for(var j = 0; j < new_indexes.length; ++j) {
                        var index  = new_indexes[j];
                        var option = option_array[index];
        
                        if(option) {
        Severity: Major
        Found in lib/swift-box.js and 2 other locations - About 1 hr to fix
        lib/swift-box.js on lines 1725..1732
        lib/swift-box.js on lines 2011..2018

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

        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 3 locations. Consider refactoring.
        Open

                for(var i = 0; i < selected_indexes.length; ++i) {
                    var index  = selected_indexes[i];
                    var option = option_array[index];
        
                    if(option) {
        Severity: Major
        Found in lib/swift-box.js and 2 other locations - About 1 hr to fix
        lib/swift-box.js on lines 1879..1886
        lib/swift-box.js on lines 2011..2018

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

        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 3 locations. Consider refactoring.
        Open

                for(var i = 0; i < selected_indexes.length; ++i) {
                    var index  = selected_indexes[i];
                    var option = option_array[index];
        
                    if(option) {
        Severity: Major
        Found in lib/swift-box.js and 2 other locations - About 1 hr to fix
        lib/swift-box.js on lines 1725..1732
        lib/swift-box.js on lines 1879..1886

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

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

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

                            for(var i = 0; i < elements.length; ++i) {
                                var element           = elements[i];
                                var container_element = getElementCache(element).container;
                    
                                container_element.tabIndex = tab_index;
                    Severity: Major
                    Found in lib/swift-box.js and 1 other location - About 1 hr to fix
                    lib/swift-box.js on lines 1972..1977

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

                    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

                            for(var i = 0; i < elements.length; ++i) {
                                var element = elements[i];
                                var text_element = getElementCache(element).text;
                    
                                text_element[textContent] = text;
                    Severity: Major
                    Found in lib/swift-box.js and 1 other location - About 1 hr to fix
                    lib/swift-box.js on lines 1687..1692

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

                    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 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
                            Severity
                            Category
                            Status
                            Source
                            Language