Konano/arknights-mower

View on GitHub
arknights_mower/solvers/schedule.py

Summary

Maintainability
A
1 hr
Test Coverage

Function need_run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def need_run(self, now: datetime.datetime = datetime.datetime.now()) -> bool:
        if self.pending:
            return False
        if self.start_up():
            if self.last_run is not None:
Severity: Minor
Found in arknights_mower/solvers/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 transition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Wontfix

    def transition(self) -> None:
        while True:
            now = datetime.datetime.now()
            if self.last_run is not None and the_same_day(self.last_run, now) is False:
                self.new_day()
Severity: Minor
Found in arknights_mower/solvers/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 load has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

    def load(self, last_run: str = '', idx: int = 0, pending: bool = False, total: int = 1, finish: int = 0):
Severity: Minor
Found in arknights_mower/solvers/schedule.py - About 35 mins to fix

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

        def load_from_disk(self, cmd_list=None, matcher: Callable = None) -> bool:
            if cmd_list is None:
                cmd_list = []
            try:
                with self.schedule_log_path.open('r', encoding='utf8') as f:
    Severity: Minor
    Found in arknights_mower/solvers/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

    Avoid too many return statements within this function.
    Wontfix

                    return False
    Severity: Major
    Found in arknights_mower/solvers/schedule.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Wontfix

                      return True
      Severity: Major
      Found in arknights_mower/solvers/schedule.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Wontfix

                return False
        Severity: Major
        Found in arknights_mower/solvers/schedule.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Wontfix

                      return True
          Severity: Major
          Found in arknights_mower/solvers/schedule.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Wontfix

                        return False
            Severity: Major
            Found in arknights_mower/solvers/schedule.py - About 30 mins to fix

              Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run(self) -> bool:
                      logger.info(f'task: {self.cmd.__name__} {self.cmd_args}')
                      if self.cmd.__name__ == 'operation':
                          if operation_one(self.cmd_args, self.device):
                              self.finish += 1
              Severity: Minor
              Found in arknights_mower/solvers/schedule.py - About 25 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

              There are no issues that match your filters.

              Category
              Status