mangroveorg/datawinners

View on GitHub

Showing 1,567 of 3,608 total issues

Function MappingEditor has 229 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DW.MappingEditor = function(entityType, filters, details, specials) {
    var self = this;
    var shareButton = $("#share-button");
    var shareWidget = $("#share-widget");
    var shareWidgetDoneButton = $("#share-widget-done");
Severity: Major
Found in datawinners/media/javascript/mapping_edit.js - About 1 day to fix

    Function dwTable has 226 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.fn.dwTable = function (options) {
            function continue_dwtable_creation() {
    
                var sliceGroups = function(data, start, length) {
                    var newData = [];
    Severity: Major
    Found in datawinners/media/javascript/data_tables/js/dwtable.js - About 1 day to fix

      Function json_parse has 222 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var json_parse = (function () {
          "use strict";
      
      // This is a function that can parse a JSON text, producing a JavaScript
      // data structure. It is a simple, recursive descent parser. It does not use
      Severity: Major
      Found in datawinners/media/javascript/JSON_fix/json_parse.js - About 1 day to fix

        Function retrocycle has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

            JSON.retrocycle = function retrocycle($) {
                "use strict";
        
        // Restore an object that was reduced by decycle. Members whose values are
        // objects of the form
        Severity: Minor
        Found in datawinners/media/javascript/JSON_fix/cycle.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 selectList has 217 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $.selectList = function (select, options) {
            var
        
                $selectSingle,
        
        
        Severity: Major
        Found in datawinners/media/javascript/selectlist/jquery.selectlist.js - About 1 day to fix

          Function continue_dwtable_creation has 213 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function continue_dwtable_creation() {
          
                      var sliceGroups = function(data, start, length) {
                          var newData = [];
                          var groupKeys = Object.keys(data);
          Severity: Major
          Found in datawinners/media/javascript/data_tables/js/dwtable.js - About 1 day to fix

            Function ajax has 208 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                ajax: function( origSettings ) {
                    var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
                    
                    var jsonp, status, data,
                        callbackContext = origSettings && origSettings.context || s,
            Severity: Major
            Found in datawinners/media/admin/js/jquery.js - About 1 day to fix

              Function ContactsGroupViewModel has 208 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function ContactsGroupViewModel() {
                  var self = this;
                  self.groups = ko.observableArray();
                  self.groupButtonText = ko.observable(gettext("Add"));
                  self.newGroupName = DW.ko.createValidatableObservable({value: ""});
              Severity: Major
              Found in datawinners/media/javascript/datasenders/contacts_group_model.js - About 1 day to fix

                Function _init has 208 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _init: function () {
                        var self = this;
                        var q = this.options;
                        this.newly_added_question = ko.observable(q.newly_added_question);
                        this.range_min = DW.ko.createValidatableObservable({value: q.range.min});
                Severity: Major
                Found in datawinners/media/javascript/entity/questionnaire_helper.js - About 1 day to fix

                  Function show_log has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def show_log(request):
                      organization = get_organization(request)
                      org_id = organization.org_id
                      args = dict(organization=org_id)
                      time_delta = get_country_time_delta(organization.country)
                  Severity: Minor
                  Found in datawinners/activitylog/views.py - 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 setDocument has 200 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  setDocument = Sizzle.setDocument = function( node ) {
                      var doc = node ? node.ownerDocument || node : preferredDoc,
                          parent = doc.defaultView;
                  
                      // If no document and documentElement is available, return

                    File views.py has 498 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
                    import json
                    import datetime
                    from operator import itemgetter
                    
                    
                    Severity: Minor
                    Found in datawinners/accountmanagement/views.py - About 7 hrs to fix

                      Function SmsViewModel has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function SmsViewModel(){
                        var self = this;
                      
                        var smsTextArea = $("#sms-text");
                      
                      
                      Severity: Minor
                      Found in datawinners/media/javascript/entity/send_sms.js - About 7 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 a Cognitive Complexity of 50 (exceeds 5 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: Minor
                      Found in datawinners/media/javascript/report/lib/filesaver.js - About 7 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 jsDump has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      QUnit.jsDump = (function() {
                          function quote( str ) {
                              return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
                          }
                          function literal( o ) {

                        File analysis.js has 477 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        $(document).ready(function () {
                        
                            var analysisTable,
                                colCustomization;
                        
                        
                        Severity: Minor
                        Found in datawinners/media/javascript/project/analysis.js - About 7 hrs to fix

                          Function ColCustomWidget has 184 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var ColCustomWidget = (function ($) {
                                  function ColCustomWidget(customizationHeader) {
                                      this.$columnWidget = $(".customization-widget");
                                      this.$custMenu = $(".customization-menu");
                                      this.$colWidgetActions = $("#customize-btn, .customization-widget-close, .customize-list-link");
                          Severity: Major
                          Found in datawinners/media/javascript/project/analysis.js - About 7 hrs to fix

                            File daterangepicker.jQuery.withoutdrilldown.js has 473 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

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

                              `` has 52 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              intellisense.annotate(jQuery, {
                                'ajax': function() {
                                  /// <signature>
                                  ///   <summary>Perform an asynchronous HTTP (Ajax) request.</summary>
                                  ///   <param name="url" type="String">A string containing the URL to which the request is sent.</param>

                                Function migrate_01 has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def migrate_01(managers, map_fun_form_model_with_date_field_docs):
                                    failed_managers = []
                                    for manager in managers:
                                        try:
                                            print manager.database

                                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