mangroveorg/datawinners

View on GitHub

Showing 1,567 of 3,608 total issues

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

def create_all_mappings(dbm):
    logger = logging.getLogger(dbm.database_name)
    for row in dbm.load_all_rows_in_view('questionnaire'):
        try:
            if row['value']['is_registration_model']:
Severity: Minor
Found in datawinners/search/manage_index.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 get_report_filters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_report_filters(dbm, config, questionnaire):
    if not hasattr(config, "filters") or not config.filters:
        return {
            "idnr_filters": [],
            "date_filters": []
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 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