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
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.
File models.py
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""TODO: Use dataclasses."""
from __future__ import annotations
import abc
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.
"""
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 = {}
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:
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 = {}
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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(
- Read upRead up
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"})
- Read upRead up
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)
- Read upRead up
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.
- Read upRead up
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(
- Read upRead up
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,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, player: Player, reason: str,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, player_scoreboard: PlayerScoreboard,
Function ban_player
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ban_player(self, player: Union[models.Player, PlayerWrapper],
Function retry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def retry(on_exc: Union[Type[Exception], Tuple[Exception, ...]],
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, player: Player, when: str,