tuokri/rs2wapy

View on GitHub
rs2wapy/adapters/adapters.py

Summary

Maintainability
D
2 days
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(self._model, models.Ban)
Severity: Info
Found in rs2wapy/adapters/adapters.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(self._model, models.Player)
Severity: Info
Found in rs2wapy/adapters/adapters.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(self._model, models.Squad)
Severity: Info
Found in rs2wapy/adapters/adapters.py by bandit

Possible hardcoded password: ''
Open

        token = ""
        # TODO: Move to parsing.py.
Severity: Info
Found in rs2wapy/adapters/adapters.py by bandit

File adapters.py has 1011 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

import base64
import datetime
import functools
Severity: Major
Found in rs2wapy/adapters/adapters.py - About 2 days to fix

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

        def _perform(self, url: str, curl_obj: pycurl.Curl = None,
    Severity: Minor
    Found in rs2wapy/adapters/adapters.py - About 45 mins to fix

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

          def ban_player(self, player: Union[models.Player, PlayerWrapper],
      Severity: Minor
      Found in rs2wapy/adapters/adapters.py - About 35 mins to fix

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

        def retry(on_exc: Union[Type[Exception], Tuple[Exception, ...]],
        Severity: Minor
        Found in rs2wapy/adapters/adapters.py - About 35 mins to fix

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

          def retry(on_exc: Union[Type[Exception], Tuple[Exception, ...]],
                    tries: int = 10, delay: int = 3, backoff: int = 2,
                    cap: int = 30):
              """Retry calling the decorated function
              using an exponential back-off with back-off cap.
          Severity: Minor
          Found in rs2wapy/adapters/adapters.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

          There are no issues that match your filters.

          Category
          Status