tuokri/rs2wapy

View on GitHub

Showing 26 of 31 total issues

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

    File parsing.py has 738 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Provides utilities for parsing responses from
    Rising Storm 2: Vietnam WebAdmin.
    
    TODO: This module is growing fast. Needs refactoring.
    Severity: Major
    Found in rs2wapy/parsing/parsing.py - About 1 day to fix

      File models.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """TODO: Use dataclasses."""
      
      from __future__ import annotations
      
      import abc
      Severity: Minor
      Found in rs2wapy/models/models.py - About 4 hrs to fix

        RS2WebAdmin has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class RS2WebAdmin:
            """Provides a high-level interface to Rising Storm 2: Vietnam
            server's WebAdmin tool.
            """
        
        
        Severity: Minor
        Found in rs2wapy/rs2wapy.py - About 3 hrs to fix

          Function parse_current_game has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def parse_current_game(self, resp: bytes) -> models.CurrentGame:
                  """TODO: headers vs. rows length assertion!"""
                  parsed_html = self.parse_html(resp)
          
                  info = {}
          Severity: Major
          Found in rs2wapy/parsing/parsing.py - About 2 hrs to fix

            RS2WebAdminResponseParser has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class RS2WebAdminResponseParser:
                # TODO: Refactor magic numbers.
            
                def __init__(self, encoding: str = None):
                    if not encoding:
            Severity: Minor
            Found in rs2wapy/parsing/parsing.py - About 2 hrs to fix

              Function parse_current_game has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_current_game(self, resp: bytes) -> models.CurrentGame:
                      """TODO: headers vs. rows length assertion!"""
                      parsed_html = self.parse_html(resp)
              
                      info = {}
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 parse_session_bans has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_session_bans(self, resp: bytes,
                                         adapter: adapters.WebAdminAdapter
                                         ) -> List[adapters.SessionBanWrapper]:
              
                      parsed_html = self.parse_html(resp)
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 parse_bans has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_bans(self, resp: bytes,
                                 adapter: adapters.WebAdminAdapter
                                 ) -> List[adapters.BanWrapper]:
              
                      parsed_html = self.parse_html(resp)
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 parse_players has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_players(self, resp: bytes, adapter: adapters.WebAdminAdapter
                                    ) -> List[adapters.PlayerWrapper]:
                      parsed_html = self.parse_html(resp)
                      if not parsed_html:
                          logger.error(
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 parse_members has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_members(self, resp: bytes,
                                    adapter: adapters.WebAdminAdapter
                                    ) -> List[adapters.MemberWrapper]:
                      parsed_html = self.parse_html(resp)
                      members_table = parsed_html.find("table", attrs={"id": "members"})
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 parse_tracking has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_tracking(self, resp: bytes,
                                     adapter: adapters.WebAdminAdapter
                                     ) -> List[adapters.TrackingWrapper]:
              
                      parsed_html = self.parse_html(resp)
              Severity: Minor
              Found in rs2wapy/parsing/parsing.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 get_persona_names has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_persona_names(self, steam_ids: List[steamid.SteamID]
                                        ) -> Dict[steamid.SteamID, str]:
                      """Return dictionary of Steam IDs to persona names
                      for given Steam IDs. Queries the Steam Web API in
                      batches of 100 Steam IDs.
              Severity: Minor
              Found in rs2wapy/steam/steam.py - About 55 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 parse_chat_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_chat_message(div: BeautifulSoup) -> models.ChatMessage:
                      teamcolor = str(div.find(
                          "span", attrs={"class": "teamcolor"}).get("style"))
                      if not teamcolor:
                          logger.error(
              Severity: Minor
              Found in rs2wapy/parsing/parsing.py - About 55 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 _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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, player: Player, reason: str,
                Severity: Minor
                Found in rs2wapy/models/models.py - About 45 mins to fix

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

                      def __init__(self, player_scoreboard: PlayerScoreboard,
                  Severity: Minor
                  Found in rs2wapy/models/models.py - About 35 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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(self, player: Player, when: str,
                        Severity: Minor
                        Found in rs2wapy/models/models.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language