mangroveorg/datawinners

View on GitHub

Showing 3,608 of 3,608 total issues

Function TemplateFetcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

DW.TemplateFetcher = function(){
  var templateCache = {};
  var templateGroupingDataCache = null;

  this.getTemplateData = function (templateId) {
Severity: Minor
Found in datawinners/media/javascript/entity/questionnaire_fetcher.js - About 25 mins 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 SubmissionAnalysisView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

DW.SubmissionAnalysisView = function(){

    var self = this;
    var tableViewOption = $("#table_view_option");
    var chartViewOption = $("#chart_view_option");
Severity: Minor
Found in datawinners/media/javascript/project/submission_analysis.js - About 25 mins 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 DataSenderFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

DW.DataSenderFilter = function (postFilterSelectionCallBack) {
    var self = this;
    var postFilterSelection = postFilterSelectionCallBack;
    this.datasenders_source_url = "/entity/datasenders/autocomplete/";

Severity: Minor
Found in datawinners/media/javascript/project/submission_results.js - About 25 mins 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 prepareExcelData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function prepareExcelData(data) {
    var reportSheet = {};
    var endCol = 0;

    for(var R = 0; data.length > R; ++R) {
Severity: Minor
Found in datawinners/media/javascript/report/export_excel.js - About 25 mins 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 delete_text_language_setting_on_field_choices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def delete_text_language_setting_on_field_choices(form_model_row_value, active_language):
    fields = form_model_row_value['json_fields']
    for field in fields:
        if field.has_key('choices'):
            choices = field['choices']
Severity: Minor
Found in support/delete_redundant_language_settings.py - About 25 mins 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 MM_swapImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
Severity: Minor
Found in datawinners/media/javascript/home/global_public.js - About 25 mins 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 _create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _create: function() {
        var self = this,
            select = this.element,//.hide(),
            selected = select.children(":selected"),
            value = selected.val() ? selected.text() : "";
Severity: Minor
Found in datawinners/media/javascript/jquery_autocomplete/jquery_combobox.js - About 25 mins 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 delete_voided_datasenders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def delete_voided_datasenders(db_name):
    logger = logging.getLogger(db_name)
    try:
        logger.info('Starting migration')
        dbm = get_db_manager(db_name)
Severity: Minor
Found in support/4.2739_migration_to_remove_voided_datasenders_from_postgres.py - About 25 mins 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 process_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def process_types(dictionary):
    """
    Process a dictionary's values according to types as defined in
    TYPE_CAST_MAP

Severity: Minor
Found in datawinners/scheduler/vumiclient.py - About 25 mins 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 correct_submissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def correct_submissions(dbm, subject_short_codes_dict, entity_question_codes_dict):
    for form_code, entity_question_code in entity_question_codes_dict.items():
        print 'Get submission by form_code: %s' % form_code
        submissions = successful_submissions(dbm, form_code)
        for submission in submissions:

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

def remove_reminders_for_deleted_questionnaires(db_name):
    logger = logging.getLogger(db_name)
    try:
       dbm = get_db_manager(db_name)
       org_id = datastore_org_id_map[db_name]

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

    def forwards(self, orm):
        for org in orm.Organization.objects.all():
            if not org.status:
                status = 'Activated'
                status_changed_datetime = datetime.datetime.now() if is_empty(org.active_date) else org.active_date

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

    def backwards(self, orm):
        for org in orm.Organization.objects.all():
            for key, value in COUNTRIES:
                if key.lower() == org.country.code.lower():
                    org.country = value
Severity: Minor
Found in datawinners/accountmanagement/migrations/0019_country_name_to_code.py - About 25 mins 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 migrate_story_2099 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def migrate_story_2099(db_name):
    logger = logging.getLogger(db_name)

    logger.info('Start migration on database')
    try:

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 6 (exceeds 5 allowed). Consider refactoring.
Open

def migrate_01(managers):
    failed_managers = []
    for manager in managers:
        try:
            print manager.database
Severity: Minor
Found in migration/from_previous_releases/couch_migration_for_mini_release_5.py - About 25 mins 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 remove_deleted_ds_from_project has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def remove_deleted_ds_from_project(db_name):
    logger = logging.getLogger(db_name)
    try:
        dbm = get_db_manager(db_name)
        logger.info("starting data fix for " + db_name)
Severity: Minor
Found in migration/couch/release_7/4.2258_data_correction.py - About 25 mins 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 has_higher_privileges_than has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def has_higher_privileges_than(self, user):
    if self.is_ngo_admin() and (user.is_extended_user() or user.is_project_manager() or user.is_no_delete_pm()):
        return True
    if self.is_extended_user() and (user.is_project_manager() or user.is_no_delete_pm()):
        return True
Severity: Minor
Found in datawinners/accountmanagement/user.py - About 25 mins 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_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def edit_user(request):
    if request.method == 'GET':
        profile = request.user.get_profile()
        if profile.mobile_phone == 'Not Assigned':
            profile.mobile_phone = ''
Severity: Minor
Found in datawinners/accountmanagement/views.py - About 25 mins 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 login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def login(driver, credential=VALID_CREDENTIALS, landing_page=None):

    LoginPage(driver).load(landing_page).login_with(credential)
    if not landing_page:
        try:
Severity: Minor
Found in func_tests/pages/loginpage/login_page.py - About 25 mins 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 get_DS_with_ca has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_DS_with_ca(dbname):
    dbm = get_db_manager(server="http://admin:admin@172.18.9.6:5984", database=dbname,credentials = ('admin','admin'))
    all_ds = get_all_entities(dbm, ['reporter'])
    for ds in all_ds:
        if 'short_code' in ds.data.keys():
Severity: Minor
Found in support/migration_to_change_case_of_shortcodes.py - About 25 mins 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

Severity
Category
Status
Source
Language