zxc23/dcss-scoreboard

View on GitHub

Showing 211 of 211 total issues

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

def write_website(
    players: Optional[Iterable], urlbase: str, extra_player_pages: int
) -> None:
    """Write all website files.

Severity: Minor
Found in scoreboard/write_website.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

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

def streakstotable(
    streaks: Sequence[orm.Streak],
    show_player: bool = True,
    show_loss: bool = True,
    limit: Optional[int] = None,
Severity: Minor
Found in scoreboard/webutils.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

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

def version_url(version: str) -> str:
    """Cleans up version strings for use in morgue URLs."""
    if version[-2:] == "a0":
        return "trunk"
    if len(version) > 4:
Severity: Minor
Found in scoreboard/modelutils.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.
Open

        return False
Severity: Major
Found in scoreboard/log_import.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return True
    Severity: Major
    Found in scoreboard/log_import.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return False
      Severity: Major
      Found in scoreboard/log_import.py - About 30 mins to fix

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

        def combo_highscores(s: sqlalchemy.orm.session.Session) -> Sequence[Game]:
            """Return the top score for each playable combo.
        
            Not every combo may have a game in the database.
            """
        Severity: Minor
        Found in scoreboard/model.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

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

        def rsync_replacement(src: str, dst: str) -> None:
            """Poor replacement for rsync on win32.
        
            Needed because shutil.copytree can't handle already existing dest dir.
            """
        Severity: Minor
        Found in scoreboard/write_website.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

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

        def fastest_wins(
            s: sqlalchemy.orm.session.Session,
            *,
            limit: int = const.GLOBAL_TABLE_LENGTH,
            exclude_bots: bool = True,
        Severity: Minor
        Found in scoreboard/model.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

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

        def setup_achievements(s: sqlalchemy.orm.session.Session) -> None:
            """Load manual achievements into the database."""
            for proto in const.ACHIEVEMENTS:
                if (
                    not s.query(Achievement)
        Severity: Minor
        Found in scoreboard/model.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

        Line too long (88 > 79 characters)
        Open

                s.query(LogfileProgress).filter(LogfileProgress.source_url == url).one_or_none()
        Severity: Minor
        Found in scoreboard/model.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (82 > 79 characters)
        Open

                    Streak.active == (sqlalchemy.true() if active else sqlalchemy.false())
        Severity: Minor
        Found in scoreboard/model.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (81 > 79 characters)
        Open

        def is_valid_streak_addition(game: orm.Game, current_streak: orm.Streak) -> bool:
        Severity: Minor
        Found in scoreboard/scoring.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (80 > 79 characters)
        Open

                    place="" if winning_games else "<td>%s</td>" % game.place.as_string,
        Severity: Minor
        Found in scoreboard/webutils.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (92 > 79 characters)
        Open

                    player = "<td><a href='players/{player_url}.html'>{player_name}<a></td>".format(
        Severity: Minor
        Found in scoreboard/webutils.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (83 > 79 characters)
        Open

                overall_highscores=model.highscores(s, limit=const.FRONTPAGE_TABLE_LENGTH),
        Severity: Minor
        Found in scoreboard/write_website.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (81 > 79 characters)
        Open

        Base = declarative_base()  # type: sqlalchemy.ext.declarative.api.DeclarativeMeta
        Severity: Minor
        Found in scoreboard/orm.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (84 > 79 characters)
        Open

            short = Column(String(10), nullable=False, index=True, unique=True)  # type: str
        Severity: Minor
        Found in scoreboard/orm.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (88 > 79 characters)
        Open

                raise Exception("Database hasn't been initialised, run setup_database() first!")
        Severity: Minor
        Found in scoreboard/orm.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (83 > 79 characters)
        Open

            short = Column(String(2), nullable=False, index=True, unique=True)  # type: str
        Severity: Minor
        Found in scoreboard/orm.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.
        Severity
        Category
        Status
        Source
        Language