svthalia/concrexit

View on GitHub
website/mailinglists/gsuite.py

Summary

Maintainability
C
1 day
Test Coverage

File gsuite.py has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""GSuite syncing helpers defined by the mailinglists package."""
import logging
from random import random
from time import sleep

Severity: Minor
Found in website/mailinglists/gsuite.py - About 5 hrs to fix

Function sync_mailing_lists has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def sync_mailing_lists(self, lists: list[GroupData] | None = None):
        """Sync mailing lists with GSuite. Lists are only deleted if all lists are synced and thus no lists are passed to this function.

        :param lists: optional parameter to determine which lists to sync
        """
Severity: Minor
Found in website/mailinglists/gsuite.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 _update_group_members has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_group_members(self, group):
        """Update the group members of the specified group based on the existing members.

        :param group: group data
        """
Severity: Minor
Found in website/mailinglists/gsuite.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def __init__(
Severity: Minor
Found in website/mailinglists/gsuite.py - About 45 mins to fix

Function create_group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create_group(self, group):
        """Create a new group based on the provided data.

        :param group: GroupData to create a group for
        """
Severity: Minor
Found in website/mailinglists/gsuite.py - About 35 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