Konano/arknights-mower

View on GitHub

Showing 99 of 1,043 total issues

Function overtake_room has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def overtake_room(self):
        name = self.task['type']
        candidate = []
        if self.operators[name]['group'] != '':
            candidate.extend([v['name'] for k, v in self.operators.items() if
Severity: Minor
Found in arknights_mower/solvers/base_schedule.py - About 3 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 initBtn has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def initBtn(event):
    room_key = event[4:]
    station_name = plan[room_key]['name'] if room_key in plan.keys() else ''
    plans = plan[room_key]['plans'] if room_key in plan.keys() else []
    if room_key.startswith('room'):
Severity: Minor
Found in menu.py - About 3 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

File recruit.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

from ..data import recruit_agent, recruit_tag
from ..ocr import ocr_rectify, ocrhandle
from ..utils import segment
Severity: Minor
Found in arknights_mower/solvers/recruit.py - About 2 hrs to fix

    Function clue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def clue(self) -> None:
            # 一些识别时会用到的参数
            global x1, x2, x3, x4, y0, y1, y2
            x1, x2, x3, x4 = 0, 0, 0, 0
            y0, y1, y2 = 0, 0, 0
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.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 read_screen has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_screen(self,img, type="mood",limit=24, cord=None, change_color=False):
            if cord is not None:
                img = img[cord[1]:cord[3], cord[0]:cord[2]]
            if 'mood' in type or type == "time":
                # 心情图片太小,复制8次提高准确率
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.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 drone has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def drone(self, room: str, one_time=False, not_return=False):
            logger.info('基建:无人机加速')
    
            # 点击进入该房间
            self.enter_room(room)
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.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

    File solver.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import annotations
    
    import time
    import traceback
    from abc import abstractmethod
    Severity: Minor
    Found in arknights_mower/utils/solver.py - About 2 hrs to fix

      BaseSolver has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class BaseSolver:
          """ Base class, provide basic operation """
      
          def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
              # self.device = device if device is not None else (recog.device if recog is not None else Device())
      Severity: Minor
      Found in arknights_mower/utils/solver.py - About 2 hrs to fix

        Function parse_operation_params has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_operation_params(args: ParamArgs = []):
            level = None
            times = -1
            potion = 0
            originite = 0
        Severity: Minor
        Found in arknights_mower/utils/param.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 menu has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def menu():
            global window
            global buffer
            loadConf()
            sg.theme('LightBlue2')
        Severity: Minor
        Found in menu.py - About 1 hr to fix

          Function scan_agant has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def scan_agant(self, agent: list[str], error_count=0, max_agent_count=-1):
                  try:
                      # 识别干员
                      self.recog.update()
                      ret = character_recognize.agent(self.recog.img)  # 返回的顺序是从左往右从上往下
          Severity: Minor
          Found in arknights_mower/solvers/base_schedule.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 ori_clue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def ori_clue(self):
                  """ 获取界面内有多少线索 """
                  clues = []
                  y3 = y1
                  status = -2
          Severity: Minor
          Found in arknights_mower/solvers/base_schedule.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 free_agent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def free_agent(img, draw=False):
              """
              识别未在工作中的干员
              """
              try:
          Severity: Minor
          Found in arknights_mower/utils/segment.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 menu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def menu():
              global window
              global buffer
              loadConf()
              sg.theme('LightBlue2')
          Severity: Minor
          Found in menu.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 add_tasks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_tasks(solver: ScheduleSolver = None, tag: str = ''):
              """
              为 schedule 模块添加任务
              """
              plan = config.SCHEDULE_PLAN.get(tag)
          Severity: Minor
          Found in arknights_mower/command.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 sift_recog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def sift_recog(query, resolution, draw=False,reverse = False):
              """
              使用 SIFT 提取特征点识别干员名称
              """
              agent_sift_init()
          Severity: Minor
          Found in arknights_mower/utils/character_recognize.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 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in arknights_mower/utils/device/scrcpy/core.py - About 1 hr to fix

            Function loadPlan has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def loadPlan(url):
                global plan
                if not os.path.isfile(url):
                    with open(url, 'w') as f:
                        json.dump(plan, f)  # 创建空json文件
            Severity: Minor
            Found in menu.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 transition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def transition(self) -> None:
                    self.recog.update()
                    if self.scene() == Scene.INDEX:
                        self.tap_element('index_infrastructure')
                    elif self.scene() == Scene.INFRA_MAIN:
            Severity: Minor
            Found in arknights_mower/solvers/base_schedule.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_device has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init_device(self) -> None:
                    # wait for the newly started ADB server to probe emulators
                    time.sleep(1)
                    if self.device_id is None or self.device_id not in config.ADB_DEVICE:
                        self.device_id = self.__choose_devices()
            Severity: Minor
            Found in arknights_mower/utils/device/adb_client/core.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

            Severity
            Category
            Status
            Source
            Language