iScrE4m/pyCardDeck

View on GitHub
pyCardDeck/deck.py

Summary

Maintainability
C
1 day
Test Coverage

File deck.py has 461 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import logging
import os
Severity: Minor
Found in pyCardDeck/deck.py - About 7 hrs to fix

Deck has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class Deck:
    """
    Deck you will be using. Make sure to create the instance somewhere reachable :)

    :param cards:       | Use this parameter if you don't plan to register your cards another way
Severity: Minor
Found in pyCardDeck/deck.py - About 3 hrs to fix

Function draw_specific has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def draw_specific(self, specific_card: CardType) -> CardType:
        """
        Draw a specific card from the deck

        .. note::
Severity: Minor
Found in pyCardDeck/deck.py - About 45 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 _card_compare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _card_compare(card: CardType, second_card: CardType) -> bool:
    """
    Function for comparing two cards. First it checks their `__eq__`,
    if that returns False, it checks `__dict__` and name of the Class
    that spawned them .
Severity: Minor
Found in pyCardDeck/deck.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 discard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def discard(self, card: CardType) -> None:
        """
        Puts a card into the discard pile

        :param card:        Card to be discarded
Severity: Minor
Found in pyCardDeck/deck.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