Showing 9 of 9 total issues
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
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
Function sum_hand
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sum_hand(hand: list):
"""
Converts ranks of cards into point values for scoring purposes.
'K', 'Q', and 'J' are converted to 10.
'A' is converted to 1 (for simplicity), but if the first hand is an ace
- Read upRead up
- Create a ticketCreate a ticket
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_choice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def card_choice() -> list:
"""
Picks a rarity, then lets you make a choice
:return: List with the card information
- Read upRead up
- Create a ticketCreate a ticket
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 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::
- Read upRead up
- Create a ticketCreate a ticket
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 .
- Read upRead up
- Create a ticketCreate a ticket
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 nope_prompt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def nope_prompt(self) -> bool:
for card in self.hand:
if card.name == "Nope":
if input("Do you want to use your Nope card?").lower().startswith("y"):
return True
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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 play
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def play(self, player):
"""
An individual player's turn.
If the player's cards are an ace and a ten or court card,
- Read upRead up
- Create a ticketCreate a ticket
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"