marcus67/little_brother

View on GitHub

Showing 111 of 152 total issues

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 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_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 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 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 __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/process_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 queue_event_kill_process has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def queue_event_kill_process(self, p_hostname, p_username, p_processhandler, p_pid, p_process_start_time,
          Severity: Minor
          Found in little_brother/process_handler_manager.py - About 45 mins to fix

            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

                                    if user2device.active and user2device.blockable and user2device.user.active:
                                        set_status = True
                                        user_status = self.user_manager.get_current_user_status(
                                            p_session_context=session_context, p_username=user2device.user.username)
            
            
            Severity: Major
            Found in little_brother/devices/device_activation_manager.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

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

                    def get_client_stats(self):
                
                        a_client_stats = client_stats.ClientStats(
                            p_version=self.get_client_version(),
                            p_revision=settings.extended_settings['debian_package_revision'],
                Severity: Minor
                Found in little_brother/app_control.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

                                        if not self._login_mapping_received:
                                            self._logger.warn(f"Setting local mapping entry for user {username}")
                                        self._login_mapping.add_entry(p_session_context=p_session_context,
                Severity: Major
                Found in little_brother/user_manager.py - About 45 mins to fix

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

                      def check_activity_duration(self, p_rule_set: RuleSetConfigModel,
                                                  p_stat_info: process_statistics.ProcessStatisticsInfo,
                                                  p_rule_result_info: RuleResultInfo):
                  
                          if p_rule_result_info.skip_negative_checks():
                  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

                                          if stat_info is not None:
                                              self._logger.debug(str(stat_info))
                  
                                              key_rule_override = rule_override.get_key(p_username=user.username,
                                                                                        p_reference_date=p_reference_time.date())
                  Severity: Major
                  Found in little_brother/app_control.py - About 45 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

                    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
                      Severity
                      Category
                      Status
                      Source
                      Language