mangroveorg/datawinners

View on GitHub

Showing 1,567 of 3,608 total issues

Function ReminderSettingsModel has 181 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ReminderSettingsModel() {
    var self = this;
    self.selected_frequency = ko.observable();
    self.select_day = ko.observable();
    self.whom_to_send_message = ko.observable();
Severity: Major
Found in datawinners/media/javascript/project/reminder_settings.js - About 7 hrs to fix

    File datasender_actions.js has 466 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    function warnThenDeleteDialogBox(allIds, all_selected, entity_type, action_element) {
        var delete_dialog = $("#delete_ds_block");
        delete_dialog.data("allIds", allIds);
        delete_dialog.data("all_selected", all_selected);
        delete_dialog.data("entity_type", entity_type);
    Severity: Minor
    Found in datawinners/media/javascript/entity/datasender_actions.js - About 7 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (j - e < h && h < l + e && k - e < n && n < m + e || j - e < h && h < l + e && k - e < o && o < m + e || j - e < g && g < l + e && k - e < n && n < m + e || j - e < g && g < l + e && k - e < o && o < m + e) {
                      if (f.snapMode != "inner") {
                          var p = Math.abs(k - o) <= e, q = Math.abs(m - n) <= e, r = Math.abs(j - g) <= e, s = Math.abs(l - h) <= e;
                          if (p)b.position.top = c._convertPositionTo("relative", {top: k - c.helperProportions.height, left: 0}).top - c.margins.top;
                          if (q)b.position.top = c._convertPositionTo("relative", {top: m, left: 0}).top - c.margins.top;
      Severity: Critical
      Found in datawinners/media/javascript/jqueryUI/jquery-ui-1.8.13.custom.min.js - About 7 hrs to fix

        File submission_index.py has 456 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        import logging
        from collections import OrderedDict
        from types import NoneType
        
        
        Severity: Minor
        Found in datawinners/search/submission_index.py - About 6 hrs to fix

          Function PollOptionsViewModel has 173 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var PollOptionsViewModel = function() {
              var self = this;
              var start_date = new Date();
              var end_date;
              var END_TIME = "T23:59:00";
          Severity: Major
          Found in datawinners/media/javascript/project/poll_options.js - About 6 hrs to fix

            Function daterangepicker has 170 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              File import_data.py has 450 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
              import os
              import logging
              import re
              
              
              Severity: Minor
              Found in datawinners/entity/import_data.py - About 6 hrs to fix

                Function QuestionnaireViewModel has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function QuestionnaireViewModel(){
                    var self = this;
                    self.questions =  ko.observableArray([]);
                    self.isEditMode = false;
                    var questionToBeDeleted = null;
                Severity: Major
                Found in datawinners/media/javascript/entity/questionnaire_view_model.js - About 6 hrs to fix

                  Function Select has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  $.Autocompleter.Select = function (options, input, select, config) {
                      var CLASSES = {
                          ACTIVE: "ac_over"
                      };
                      

                    Function _tabify has 162 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        }, _tabify: function (b) {
                            function e(g, f) {
                                g.css("display", "");
                                !d.support.opacity && f.opacity && g[0].style.removeAttribute("filter")
                            }
                    Severity: Major
                    Found in datawinners/media/javascript/jqueryUI/jquery-ui-1.8.13.custom.min.js - About 6 hrs to fix

                      File admin.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
                      import datetime
                      import logging
                      
                      from django.contrib.auth.admin import UserAdmin
                      Severity: Minor
                      Found in datawinners/accountmanagement/admin.py - About 6 hrs to fix

                        Function viewModel has 153 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var viewModel = function () {
                            var self = this;
                            this.fullName = DW.ko.createValidatableObservable({value: ""});
                            this.email = DW.ko.createValidatableObservable({value: ""});
                            this.title = DW.ko.createValidatableObservable({value: ""});
                        Severity: Major
                        Found in datawinners/media/javascript/account/edit_user_view_model.js - About 6 hrs to fix

                          Function utils has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                          Open

                          ko.validation.utils = (function () {
                              var seedId = new Date().getTime();
                          
                              var domData = {}; //hash of data objects that we reference from dom elements
                              var domDataKey = '__ko_validation__';
                          Severity: Minor
                          Found in datawinners/media/javascript/Knockout-Validation/Src/utils.js - About 6 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 reminder_settings has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def reminder_settings(request, project_id):
                              dbm = get_database_manager(request.user)
                              questionnaire = Project.get(dbm, project_id)
                              dashboard_page = settings.HOME_PAGE + "?deleted=true"
                              if questionnaire.is_void():
                          Severity: Minor
                          Found in datawinners/project/wizard_view.py - About 6 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

                          File gsm0338.py has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
                          
                          """ Python Character Mapping Codec based on gsm0338 generated from './GSM0338.TXT' with gencodec.py.
                          
                              With extra sauce to deal with the 'multibyte' extensions!
                          Severity: Minor
                          Found in datawinners/gsm0338.py - About 6 hrs to fix

                            Function _fnScrollDraw has 151 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function _fnScrollDraw ( settings )
                                {
                                    // Given that this is such a monster function, a lot of variables are use
                                    // to try and keep the minimised size as small as possible
                                    var
                            Severity: Major
                            Found in datawinners/media/javascript/data_tables/js/jquery.dataTables.js - About 6 hrs to fix

                              File jquery.sprintf.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*
                               * jQuery sprintf - perl based functionallity for sprintf and friends.
                               *
                               * Copyright © 2008 Carl Fürstenberg
                               *
                              Severity: Minor
                              Found in datawinners/media/javascript/jquery.sprintf.js - About 5 hrs to fix

                                File xform_submission_exporter.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                from collections import OrderedDict
                                import json
                                import os
                                from tempfile import TemporaryFile, mkdtemp
                                import tempfile
                                Severity: Minor
                                Found in datawinners/blue/xform_submission_exporter.py - About 5 hrs to fix

                                  Function viewModel has 147 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  var viewModel = function () {
                                      var self = this;
                                      this.fullName = DW.ko.createValidatableObservable({value: ""});
                                      this.email = DW.ko.createValidatableObservable({value: ""});
                                      this.title = DW.ko.createValidatableObservable({value: ""});
                                  Severity: Major
                                  Found in datawinners/media/javascript/account/add_user_view_model.js - About 5 hrs to fix

                                    Function equiv has 147 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    QUnit.equiv = (function() {
                                    
                                        // Call the o related callback with the given arguments.
                                        function bindCallbacks( o, callbacks, args ) {
                                            var prop = QUnit.objectType( o );
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language