marcus67/little_brother

View on GitHub

Showing 111 of 152 total issues

Function add_activity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_activity(self, p_activity):

        self.activities.append(p_activity)

        for host_stat in p_activity.host_stats.values():
Severity: Minor
Found in little_brother/process_statistics.py - About 55 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_info_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

        if p_rule_result_info.minutes_left_today is not None:
            p_rule_result_info.applying_rules |= rule_result_info.INFO_REMAINING_PLAYTIME
Severity: Minor
Found in little_brother/rule_handler.py - About 55 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_min_break has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_min_break(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 55 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_for_session has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def set_time_extension_for_session(self, p_session_context, p_user_name, p_delta, p_session_active,
                                       p_session_end_datetime, p_reference_time=None):

        if p_reference_time is None:
            p_reference_time = tools.get_current_time()
Severity: Minor
Found in little_brother/persistence/persistent_time_extension_entity_manager.py - About 55 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_context_details has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_context_details(self, p_context_detail):

        if p_context_detail in WEEKPLAN_PREDEFINED_DETAILS:
            return

Severity: Minor
Found in little_brother/simple_context_rule_handlers.py - About 55 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 scan_processes has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def scan_processes(self, p_session_context, p_reference_time, p_server_group, p_login_mapping, p_host_name,
Severity: Major
Found in little_brother/process_handler.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, p_config,
    Severity: Major
    Found in little_brother/app_control.py - About 50 mins to fix

      Function scan_processes has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def scan_processes(self, p_session_context, p_reference_time, p_server_group, p_login_mapping, p_host_name,
      Severity: Major
      Found in little_brother/client_device_handler.py - About 50 mins to fix

        Function scan_processes has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def scan_processes(self, p_session_context, p_reference_time, p_server_group, p_login_mapping, p_host_name,
        Severity: Major
        Found in little_brother/client_process_handler.py - About 50 mins to fix

          Function check_vacation_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_vacation_data(self):
          
                  if self._vacation_data is None:
                      url = self._config.vacation_data_url
                      request = requests.get(url)
          Severity: Minor
          Found in little_brother/german_vacation_context_rule_handler.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

          Function get_active_ruleset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_active_ruleset(self, p_rule_sets, p_reference_date) ->  RuleSet:
          
                  active_ruleset = None
                  max_priority = None
          
          
          Severity: Minor
          Found in little_brother/rule_handler.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

          Avoid deeply nested control flow statements.
          Open

                              for i in range(len(user_stat_info.day_statistics), lookback + 1):
                                  user_stat_info.day_statistics.append(DayStatistics())
          
          
          Severity: Major
          Found in little_brother/process_statistics.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if current_pinfo is None:
                                        event = admin_event.AdminEvent(
                                            p_event_type=admin_event.EVENT_TYPE_PROCESS_START,
                                            p_hostname=device_info.hostname,
                                            p_hostlabel=device_info.device_name,
            Severity: Major
            Found in little_brother/client_device_handler.py - About 45 mins to fix

              Function process_rule_sets_for_user has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def process_rule_sets_for_user(self, p_rule_sets, p_stat_info, p_active_time_extension,
              Severity: Minor
              Found in little_brother/rule_handler.py - About 45 mins to fix

                Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, p_username, p_reference_time, p_max_lookback_in_days, p_min_activity_duration,
                Severity: Minor
                Found in little_brother/process_statistics.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if current_pinfo is not None:
                                              event = self.create_admin_event_process_end_from_pinfo(
                                                  p_pinfo=current_pinfo,
                                                  p_reference_time=p_reference_time)
                                              events.append(event)
                  Severity: Major
                  Found in little_brother/client_device_handler.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if self.prometheus_client is not None:
                                                self.prometheus_client.count_forced_logouts(p_username=p_user.username)
                    
                    
                    Severity: Major
                    Found in little_brother/process_handler_manager.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if pinfo.end_time is not None:
                                                      event = self.create_admin_event_process_start_from_pinfo(p_pinfo=pinfo)
                                                      events.append(event)
                      
                      
                      Severity: Major
                      Found in little_brother/client_process_handler.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    for device in devices:
                                                        if request.form['submit'] == device.delete_html_key:
                                                            self.device_entity_manager.delete_device(
                                                                p_session_context=session_context, p_id=device.id)
                        
                        
                        Severity: Major
                        Found in little_brother/web/devices_view_handler.py - About 45 mins to fix

                          Function process_queue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def process_queue(self):
                          
                                  while self._event_queue.qsize() > 0:
                                      try:
                                          event = self._event_queue.get(block=False)
                          Severity: Minor
                          Found in little_brother/event_handler.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

                          Severity
                          Category
                          Status
                          Source
                          Language