Konano/arknights-mower

View on GitHub

Showing 944 of 1,043 total issues

File base_schedule.py has 1439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations
import copy
import time
from enum import Enum
from datetime import datetime, timedelta
Severity: Major
Found in arknights_mower/solvers/base_schedule.py - About 3 days to fix

    Function plan_solver has a Cognitive Complexity of 169 (exceeds 5 allowed). Consider refactoring.
    Open

        def plan_solver(self):
            plan = self.currentPlan
            # 如果下个 普通任务 <10 分钟则跳过 plan
            if (
            next((e for e in self.tasks if 'type' not in e.keys() and e['time'] < datetime.now() + timedelta(seconds=600)),
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 3 days 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 agent_get_mood has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
    Open

        def agent_get_mood(self,skip_dorm = False):
            # 如果5分钟之内有任务则跳过心情读取
            if next((k for k in self.tasks if k['time'] <datetime.now()+ timedelta(seconds=300)),None) is not None:
                logger.info('有未完成的任务,跳过纠错')
                return
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 2 days 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 agent_arrange has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
    Open

        def agent_arrange(self, plan: tp.BasePlan, read_time_room=[]):
            logger.info('基建:排班')
            in_and_out = []
            fia_room = ""
            rooms = list(plan.keys())
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 2 days 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 choose_agent has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

        def choose_agent(self, agents: list[str], room: str) -> None:
            """
            :param order: ArrangeOrder, 选择干员时右上角的排序功能
            """
            first_name = ''
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 1 day 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_swap_plan has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_swap_plan(self, resting_dorm, operators, skip_read_time):
            result = {}
            agents = copy.deepcopy(operators)
            # 替换计划
            for a in operators:
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 1 day 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 plan_metadata has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def plan_metadata(self, time_result):
            group_info = self.task['metadata']['plan']
            read_time_rooms = self.task['metadata']['room']
            if time_result is None:
                time_result = {}
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 7 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 48 (exceeds 5 allowed). Consider refactoring.
    Open

    def read_screen(img, type="mood", langurage="eng", limit=24, cord=None, change_color=False, draw=False) -> int:
        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/utils/segment.py - About 7 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 get_agent has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_agent(self):
            plan = self.currentPlan
            high_production = []
            replacements = []
            for room in plan.keys():
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 6 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

    BaseSchedulerSolver has 44 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BaseSchedulerSolver(BaseSolver):
        """
        收集基建的产物:物资、赤金、信赖
        """
    
    
    Severity: Minor
    Found in arknights_mower/solvers/base_schedule.py - About 6 hrs to fix

      Function get_agent_from_room has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_agent_from_room(self, room, read_time_index=[]):
              error_count = 0
              if room == 'meeting':
                  time.sleep(3)
              while self.find('room_detail') is None:
      Severity: Minor
      Found in arknights_mower/solvers/base_schedule.py - About 5 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 maa_plan_solver has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          def maa_plan_solver(self):
              try:
                  if self.maa_config['last_execution'] is not None and datetime.now() - timedelta(seconds=self.maa_config['maa_execution_gap']*3600)< self.maa_config['last_execution']:
                      logger.info("间隔未超过设定时间,不启动maa")
                  else:
      Severity: Minor
      Found in arknights_mower/solvers/base_schedule.py - About 4 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 infra_main has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def infra_main(self):
              """ 位于基建首页 """
              if self.find('control_central') is None:
                  self.back()
                  return
      Severity: Minor
      Found in arknights_mower/solvers/base_schedule.py - About 4 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 recog_view_mask_right has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def recog_view_mask_right(self) -> int:
              """ 识别线索视图中右边黑色 mask 边缘的位置 """
              x3 = x2
              while True:
                  max_abs = 0
      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

      File const.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      This module includes all consts used in this project
      """
      
      # Action
      Severity: Minor
      Found in arknights_mower/utils/device/scrcpy/const.py - About 3 hrs to fix

        File menu.py has 310 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        from multiprocessing import Pipe, Process, freeze_support
        import time
        from datetime import datetime
        import PySimpleGUI as sg
        Severity: Minor
        Found in menu.py - About 3 hrs to fix

          Function simulate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

          def simulate():
              '''
              具体调用方法可见各个函数的参数说明
              '''
              global ope_list
          Severity: Minor
          Found in diy.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 simulate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          def simulate():
              '''
              具体调用方法可见各个函数的参数说明
              '''
              tasks = []
          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 recognize.py has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from __future__ import annotations
          
          import time
          from typing import List, Optional
          
          
          Severity: Minor
          Found in arknights_mower/utils/recognize.py - About 3 hrs to fix

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

                def get_infra_scene(self)-> int:
                    if self.scene != Scene.UNDEFINED:
                        return self.scene
                    if self.find('connecting', scope=((self.w//2, self.h//10*8), (self.w//4*3, self.h))) is not None:
                        self.scene = Scene.CONNECTING
            Severity: Minor
            Found in arknights_mower/utils/recognize.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

            Severity
            Category
            Status
            Source
            Language