mangroveorg/datawinners

View on GitHub

Showing 1,567 of 3,608 total issues

Function BlobBuilder has 146 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
        var
              get_class = function(object) {
                return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
            }
Severity: Major
Found in datawinners/media/javascript/report/lib/blob.js - About 5 hrs to fix

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

        function _sprintf_format( type, value, flags ) {
    
            // Similar to how perl printf works
            if( value == undefined ) {
                if( type == 's' ) {
    Severity: Major
    Found in datawinners/media/javascript/jquery.sprintf.js - About 5 hrs to fix

      Function install has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function install(el, opts) {
          var full = (el == window);
          var msg = opts && opts.message !== undefined ? opts.message : undefined;
          opts = $.extend({}, $.blockUI.defaults, opts || {});
          opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
      Severity: Major
      Found in datawinners/media/javascript/jquery.blockUI.js - About 5 hrs to fix

        Function install has 144 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function install(el, opts) {
            var full = (el == window);
            var msg = opts && opts.message !== undefined ? opts.message : undefined;
            opts = $.extend({}, $.blockUI.defaults, opts || {});
            opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
        Severity: Major
        Found in datawinners/media/javascript/jquery.blockUI-tmp.js - About 5 hrs to fix

          Function _create_questions has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create_questions(self, fields, parent_field_code=None):
                  questions = []
                  errors = []
                  info = []
                  for field in fields:
          Severity: Minor
          Found in datawinners/blue/xform_bridge.py - About 5 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 Plugin has 143 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Plugin($container, options) {
                  /**
                   * The options of the colorpicker extended with the defaults.
                   *
                   * @property options
          Severity: Major
          Found in datawinners/media/javascript/jquery.tinycolorpicker.js - About 5 hrs to fix

            ReminderSettingsPage has 42 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ReminderSettingsPage(Page):
                def __init__(self, driver):
                    Page.__init__(self, driver)
                    self.enable_reminder = {BEFORE_DEADLINE: self.enable_before_deadline_reminder,
                                       ON_DEADLINE: self.enable_on_deadline_reminder,
            Severity: Minor
            Found in func_tests/pages/reminderpage/reminder_settings_page.py - About 5 hrs to fix

              Function decycle has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

                  JSON.decycle = function decycle(object) {
                      "use strict";
              
              // Make a deep copy of an object or array, assuring that there is at most
              // one instance of each object or array in the resulting structure. The
              Severity: Minor
              Found in datawinners/media/javascript/JSON_fix/cycle.js - About 5 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 daterangepicker has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              jQuery.fn.daterangepicker = function(settings){
                  var rangeInput = jQuery(this);
                  
                  //defaults
                  var options = jQuery.extend({

              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 _update_search_dict has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              def _update_search_dict(dbm, form_model, fields, search_dict, submission_doc, submission_values, parent_field_name=None):
                  for field in fields:
                      entry = submission_values.get(field.code)
                      label_to_be_displayed = get_label_to_be_displayed(entry, field, form_model, submission_doc)
                      es_field_name = es_questionnaire_field_name(field.code, form_model.id, parent_field_name)
              Severity: Minor
              Found in datawinners/search/submission_index.py - About 5 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 saveAs has 138 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var saveAs = saveAs || (function(view) {
                  "use strict";
                  // IE <10 is explicitly unsupported
                  if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
                      return;
              Severity: Major
              Found in datawinners/media/javascript/report/lib/filesaver.js - About 5 hrs to fix

                ProjectDataSendersPage has 41 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ProjectDataSendersPage(Page):
                    def __init__(self, driver):
                        super(ProjectDataSendersPage, self).__init__(driver)
                
                    def navigate_to_add_a_data_sender_page(self, wait_for_page_loading=False, lightbox=True):
                Severity: Minor
                Found in func_tests/pages/projectdatasenderspage/project_data_senders_page.py - About 5 hrs to fix

                  Function _fnCalculateColumnWidths has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function _fnCalculateColumnWidths ( oSettings )
                      {
                          var
                              table = oSettings.nTable,
                              columns = oSettings.aoColumns,
                  Severity: Major
                  Found in datawinners/media/javascript/data_tables/js/jquery.dataTables.js - About 5 hrs to fix

                    Function MultiSelectWidget has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    DW.MultiSelectWidget = function (parentSelector, items, title) {
                        var _this = this,
                            parentElement = document.querySelector(parentSelector),
                            headerDiv = document.createElement('div'),
                            dropdownDiv = document.createElement('div'),
                    Severity: Major
                    Found in datawinners/media/javascript/multi_select_widget.js - About 5 hrs to fix

                      Function dependentObservable has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
                          var _latestValue,
                              _hasBeenEvaluated = false,
                              _isBeingEvaluated = false,
                              _suppressDisposalUntilDisposeWhenReturnsFalse = false,

                        File reminder_settings.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        $.valHooks.textarea = {
                            get: function (elem) {
                                return elem.value.replace(/\r?\n/g, "\r\n");
                            }
                        };
                        Severity: Minor
                        Found in datawinners/media/javascript/project/reminder_settings.js - About 5 hrs to fix

                          File submission_results.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                              DW.SubmissionTabs = function () {
                              var self = this;
                          
                              var tabList = ["all", "success", "error", "duplicates", "deleted", "analysis"];
                              var active_tab_index = 0;
                          Severity: Minor
                          Found in datawinners/media/javascript/project/submission_results.js - About 5 hrs to fix

                            Function TimeSpan has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                            Open

                            var TimeSpan = function (days, hours, minutes, seconds, milliseconds) {
                                var attrs = "days hours minutes seconds milliseconds".split(/\s+/);
                                
                                var gFn = function (attr) { 
                                    return function () { 

                            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 TimeSpan has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                            Open

                            var TimeSpan = function (days, hours, minutes, seconds, milliseconds) {
                                var attrs = "days hours minutes seconds milliseconds".split(/\s+/);
                                
                                var gFn = function (attr) { 
                                    return function () { 

                            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 TimeSpan has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                            Open

                            var TimeSpan = function (days, hours, minutes, seconds, milliseconds) {
                                var attrs = "days hours minutes seconds milliseconds".split(/\s+/);
                                
                                var gFn = function (attr) { 
                                    return function () { 

                            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