Konano/arknights-mower

View on GitHub

Showing 99 of 1,043 total issues

Avoid deeply nested control flow statements.
Open

                        if x[0] == agent[idx]:
                            self.tap(x[1], x_rate=0.5, y_rate=0.5, interval=0)
                            found = 1
                            break

Severity: Major
Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if min_mood == -99:
                                    min_mood = agent['mood']
                                break
    Severity: Major
    Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

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

          def swipe(
      Severity: Minor
      Found in arknights_mower/utils/device/scrcpy/control.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for y in ret:
                                    if y[0] == '菲亚梅塔':
                                        self.tap((y[1][0]), interval=0, rebuild=False)
                                        break
                                agent.remove('菲亚梅塔')
        Severity: Major
        Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for _ in range(9):
                                      self.swipe_only((w//2, h//2), (w//2, 0), interval=0.5)
                                  self.swipe((w//2, h//2), (w//2, 0), interval=3, rebuild=False)
          Severity: Major
          Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        for x in group_resting:
                                            if self.operators[x['agent']]['resting_priority'] == 'low':
                                                continue
                                            else:
                                                group_restingCount += 1
            Severity: Major
            Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if error_count >= 3:
                                              raise e
                                          # 返回基建干员进驻总览
                                          self.recog.update()
              Severity: Major
              Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if a == "Current":
                                            continue
                                        elif 'exhaust_require' in self.operators[a].keys() and self.operators[a]['exhaust_require']:
                                            ignore.append(a)
                        resting_dorm.extend([self.operators[a]['current_room'] for a in ignore])
                Severity: Major
                Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if dorm not in read_time_rooms:
                                              continue
                                          if dorm in time_result.keys() and min_time > time_result[dorm]:
                  Severity: Major
                  Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if group_restingCount + actuall_resting <= self.dorm_count:
                                                    need_to_rest.extend(group_resting)
                                                    actuall_resting += group_restingCount
                                                else:
                                                    # 因为人数不够而跳过记录心情
                    Severity: Major
                    Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if self.find('arrange_empty_room') is None:
                                                  if self.find('arrange_clean') is not None:
                                                      self.tap_element('arrange_clean')
                                                  else:
                                                      # 对于只有一个干员的房间,没有清空按钮,需要点击干员清空
                      Severity: Major
                      Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if base_room_list[idx].startswith('dormitory'):
                                                        default_order = ArrangeOrder.FEELING
                                                    else:
                                                        default_order = ArrangeOrder.SKILL
                                                    self.choose_agent(
                        Severity: Major
                        Found in arknights_mower/solvers/base_construct.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if dorm in time_result.keys() and min_time > time_result[dorm]:
                                                      min_time = time_result[dorm]
                                              _plan["time"] = min_time
                          Severity: Major
                          Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if k not in existing_plan['plan']:
                                                        existing_plan['plan'][k] = _plan['plan'][k]
                                                    else:
                                                        for idx, _a in enumerate(_plan['plan'][k]):
                                                            if _plan['plan'][k][idx] != 'Current':
                            Severity: Major
                            Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if next((e for e in self.tasks if 'type' in e.keys() and e['type'] == agent['agent']),
                                                                  None) is None:
                                                              __agent = self.operators[agent['agent']]
                                                              self.enter_room(__agent['current_room'])
                                                              result = self.get_agent_from_room(__agent['current_room'], [__agent['current_index']])
                              Severity: Major
                              Found in arknights_mower/solvers/base_schedule.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if x in possibility[o].ls:
                                                            possibility[o].poss += 1
                                                    possibility[o].poss /= len(possibility[o].ls)
                                Severity: Major
                                Found in arknights_mower/solvers/recruit.py - About 45 mins to fix

                                  Function tap has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def tap(self, points: list[tuple[int, int]], display_frames: tuple[int, int, int], pressure: int = 100, duration: int = None, lift: bool = True) -> None:
                                  Severity: Minor
                                  Found in arknights_mower/utils/device/minitouch/core.py - About 35 mins to fix

                                    Function read_screen has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def read_screen(self,img, type="mood",limit=24, cord=None, change_color=False):
                                    Severity: Minor
                                    Found in arknights_mower/solvers/base_schedule.py - About 35 mins to fix

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

                                      def agent_name(__img, height,reverse = False, draw: bool = False):
                                          query = cv2.cvtColor(np.array(__img), cv2.COLOR_RGB2GRAY)
                                          h, w= query.shape
                                          dim = (w*4, h*4)
                                          # resize image
                                      Severity: Minor
                                      Found in arknights_mower/utils/character_recognize.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

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

                                          def get_clue_mask(self) -> None:
                                              """ 界面内是否有被选中的线索 """
                                              try:
                                                  mask = []
                                                  for y in range(y1, y2):
                                      Severity: Minor
                                      Found in arknights_mower/solvers/base_schedule.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language