mangroveorg/datawinners

View on GitHub

Showing 3,608 of 3,608 total issues

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

def format_fieldset_values_for_representation(entry, field_set, submission_id):
    formatted_value = ''
    if entry is not None:
        data_to_iterate = entry
        if not isinstance(entry, list):
Severity: Minor
Found in datawinners/search/submission_query.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 delete_old_views has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_old_views(self, current_views, new_views, manager):
        for current_view_name in current_views.keys():
            if current_view_name not in new_views:
                print 'Deleting view: %s from db: %s' % (current_view_name, manager.database.name)
                logging.info('Deleting view: %s from db: %s', current_view_name, manager.database.name)
Severity: Minor
Found in datawinners/main/management/sync_changed_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 create_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_response(self, required_field_names, query):
        subjects = []
        for res in query.values_dict():
            subject = []
            for key in required_field_names:
Severity: Minor
Found in datawinners/search/entity_search.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_header_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_header_dict(self):
        header_dict = OrderedDict()
        header_dict.update(self.update_static_header_info())

        def key_attribute(field):
Severity: Minor
Found in datawinners/search/submission_headers.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 _filter_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _filter_value(qn, filters):
    type_and_value = _filter_type_and_value(qn, filters)
    value = type_and_value and type_and_value.split(";")[2] or None
    if _type(qn, filters) == "date":
        value = value and [parse_date(date) for date in value.split("to")]
Severity: Minor
Found in datawinners/report/filter.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 _update_header_dict_from_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_header_dict_from_fields(self, fields, header_dict, parent_field_code=None):
        for field in fields:
            if field.is_entity_field:
                self.add_unique_id_in_header_dict(header_dict, field, parent_field_code, parent_field_types=[], nested=False)
            elif isinstance(field, FieldSet) and field.is_group():
Severity: Minor
Found in datawinners/search/submission_headers.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 _append_if_attachments_are_present has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _append_if_attachments_are_present(self, res, key, media_field_codes, image_fields, submission_id):
        if self.form_model.is_media_type_fields_present and key in media_field_codes:
            if key in image_fields:
                return _format_media_value(submission_id, safe_getattr(res, key), thumbnail_flag=True)
            else:
Severity: Minor
Found in datawinners/search/submission_query.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 send_deactivate_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def send_deactivate_email():
    organizations = get_expired_trial_organizations_without_deactivate_email_sent()
    if not organizations:
        pass

Severity: Minor
Found in datawinners/deactivate/deactive.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