OCA/server-tools

View on GitHub
field_rrule/field_rrule.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function __iter__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __iter__(self):
        for rule in self._rrule:
            yield dict(type='rrule', **{
                key[1:]:
                fields.Datetime.to_string(
Severity: Minor
Found in field_rrule/field_rrule.py - About 2 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 convert_to_cache has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_to_cache(self, value, record, validate=True):
        result = SerializableRRuleSet()
        if not value:
            return result
        if isinstance(value, SerializableRRuleSet):
Severity: Minor
Found in field_rrule/field_rrule.py - About 1 hr 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 convert_to_cache_parse_data_rrule has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_to_cache_parse_data_rrule(self, record, data):
        """parse a data dictionary from the database"""
        return {
            key: fields.Datetime.from_string(value)
            if '_%s' % key in _RRULE_DATETIME_FIELDS
Severity: Minor
Found in field_rrule/field_rrule.py - About 1 hr 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 _add_tz has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_tz(self, value, tz):
        """set the timezone on an rruleset and adjust dates there"""
        value.tz = tz
        tz = gettz(tz)
        for rule in value._rrule:
Severity: Minor
Found in field_rrule/field_rrule.py - About 45 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

There are no issues that match your filters.

Category
Status