mangroveorg/datawinners

View on GitHub

Showing 1,567 of 3,608 total issues

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

def migrate_01(managers, map_fun_project_docs, map_fun_raw_form_model_docs, map_fun_submission_docs):
    for manager in managers:
        initializer.run(manager)
        submissions = manager.database.query(map_fun_submission_docs)
        for submission in submissions:
Severity: Minor
Found in migration/from_previous_releases/couchmigrations.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 edit has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def edit(self, node, old_field, new_field, old_xform, new_xform, activity_log_detail):
        if not isinstance(new_field, SelectField) or not isinstance(old_field, SelectField) or new_field.is_cascade:
            return

        for new_option in new_field.options:
Severity: Minor
Found in datawinners/blue/rules/choice_rule.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 TimeSpan has 130 lines of code (exceeds 25 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 () { 

    Function TimeSpan has 130 lines of code (exceeds 25 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 () { 

      Function TimeSpan has 130 lines of code (exceeds 25 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 () { 

        Function Callbacks has 128 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        jQuery.Callbacks = function( options ) {
        
            // Convert options from String-formatted to Object-formatted if needed
            // (we check in cache first)
            options = typeof options === "string" ?

          Function AnalysisPageDataTable has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var AnalysisPageDataTable = (function ($, tableElement) {
                  function AnalysisPageDataTable(columns) {
                      tableElement.DataTable({
                          "pageLength": 25,
                          "dom": '<ip<t>ipfl>',
          Severity: Major
          Found in datawinners/media/javascript/project/analysis.js - About 5 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                        if ( event.pageX == null && original.clientX != null ) {
                            eventDoc = event.target.ownerDocument || document;
                            doc = eventDoc.documentElement;
                            body = eventDoc.body;
            
            

              SubmissionLogPage has 38 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SubmissionLogPage(Page):
                  def __init__(self, driver):
                      Page.__init__(self, driver)
                      self.date_range_dict = {CURRENT_MONTH: CURRENT_MONTH_LABEL,
                                      LAST_MONTH: LAST_MONTH_LABEL,
              Severity: Minor
              Found in func_tests/pages/submissionlogpage/submission_log_page.py - About 5 hrs to fix

                Function PaginationWidget has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function PaginationWidget(containerSelector, prevCallback, nextCallback, pageSize, count, totalCount) {
                    var _this = this;
                    _this.currentPageNumber = 1;
                    _this.pageSize = pageSize;
                    _this.totalCount = totalCount;
                Severity: Major
                Found in datawinners/media/javascript/pagination_widget.js - About 4 hrs to fix

                  Function TimePeriod has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var TimePeriod = function (years, months, days, hours, minutes, seconds, milliseconds) {
                      var attrs = "years months 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 TimePeriod has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var TimePeriod = function (years, months, days, hours, minutes, seconds, milliseconds) {
                      var attrs = "years months 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 TimePeriod has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var TimePeriod = function (years, months, days, hours, minutes, seconds, milliseconds) {
                      var attrs = "years months 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 migrate_01 has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def migrate_01(managers):
                      failed_managers = []
                      failed_users = []
                      print "Updating existing project that have web device to have smartPhone device"
                  
                  
                  Severity: Minor
                  Found in migration/from_previous_releases/couch_migration_for_release_6.py - About 4 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 actions has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      $.fn.actions = function(opts) {
                          var options = $.extend({}, $.fn.actions.defaults, opts);
                          var actionCheckboxes = $(this);
                          var list_editable_changed = false;
                          checker = function(checked) {
                  Severity: Major
                  Found in datawinners/media/admin/js/actions.js - About 4 hrs to fix

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

                    QUnit.load = function() {
                        runLoggingCallbacks( "begin", QUnit, {} );
                    
                        // Initialize the config, saving the execution queue
                        var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,

                      Function getElementsBySelector has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      document.getElementsBySelector = function(selector) {
                        // Attempt to fail gracefully in lesser browsers
                        if (!document.getElementsByTagName) {
                          return new Array();
                        }
                      Severity: Major
                      Found in datawinners/media/admin/js/getElementsBySelector.js - About 4 hrs to fix

                        File models.py has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
                        from collections import defaultdict
                        import datetime
                        import re
                        from dateutil.relativedelta import relativedelta
                        Severity: Minor
                        Found in datawinners/accountmanagement/models.py - About 4 hrs to fix

                          Function ReminderSettingsModel has a Cognitive Complexity of 32 (exceeds 5 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: Minor
                          Found in datawinners/media/javascript/project/reminder_settings.js - About 4 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

                          Consider simplifying this complex logical expression.
                          Open

                                  if ( event.pageX == null && event.clientX != null ) {
                                      var doc = document.documentElement, body = document.body;
                                      event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
                                      event.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);
                                  }
                          Severity: Critical
                          Found in datawinners/media/admin/js/jquery.js - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language