marcus67/little_brother

View on GitHub

Showing 111 of 152 total issues

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

    def version_class(self):
        if self.master_version is not None:
            if self.client_stats is not None and self.client_stats.version is not None:
                client_version = self.client_stats.version

Severity: Minor
Found in little_brother/client_info.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 regex_validator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def regex_validator(_form, field):
    if field.data is not None:
        sub_patterns = field.data.replace('\r', '').split('\n')

        for sub_pattern in sub_patterns:
Severity: Minor
Found in little_brother/entity_forms.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 dns_validator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def dns_validator(_form, field):
    urls = field.data.splitlines()

    for url in urls:
        if url.strip() != "":
Severity: Minor
Found in little_brother/entity_forms.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(cls, p_forms):

        valid = True
        submitted = False

Severity: Minor
Found in little_brother/web/base_view_handler.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 is_active has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def is_active(self, p_reference_date, p_details):

        state_name = p_details

        key = "{date}|{state}".format(date=datetime.datetime.strftime(p_reference_date, "%d%m%Y"), state=state_name)
Severity: Minor
Found in little_brother/german_vacation_context_rule_handler.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 api_request_time_extension has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def api_request_time_extension(self):
        request = flask.request

        with tools.TimingContext(lambda duration:self.measure(p_hostname=request.remote_addr,
                                                         p_service=request.url_rule, p_duration=duration)):
Severity: Minor
Found in little_brother/api/api_view_handler.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_admin_infos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_admin_infos(self, p_session_context, p_user_names, p_process_infos):

        admin_infos = []

        user_infos = self.get_user_status_infos(p_session_context=p_session_context, p_include_history=False,
Severity: Minor
Found in little_brother/admin_data_handler.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 check_time_of_day has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_time_of_day(self, p_rule_set: RuleSetConfigModel, p_stat_info: process_statistics.ProcessStatisticsInfo,
                          p_rule_result_info: RuleResultInfo):

        if p_rule_result_info.skip_negative_checks():
            # shortcut because granting playtime has higher priority
Severity: Minor
Found in little_brother/rule_handler.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 check_issue_logout_warning has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_issue_logout_warning(self, p_username, p_rule_result_info: RuleResultInfo):

        issue_warning = False
        notification = None

Severity: Minor
Found in little_brother/process_handler_manager.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 set_time_extension has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set_time_extension(cls, p_session_context, p_username, p_reference_datetime, p_start_datetime, p_time_delta):

        session = p_session_context.get_session()
        result = session.query(TimeExtension).filter(
            and_(
Severity: Minor
Found in little_brother/persistence/persistent_time_extension_entity_manager.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 save_admin_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def save_admin_data(self, p_admin_infos, p_forms):

        for admin_info in p_admin_infos:
            for day_info in admin_info.day_infos:
                form = p_forms[day_info.html_key]
Severity: Minor
Found in little_brother/web/admin_view_handler.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