johejo/gpm-player

View on GitHub

Showing 6 of 6 total issues

Function _play_track has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def _play_track(self, track_id):
        self.prepare()

        try:
            info = self.api.get_track_info(track_id)
Severity: Minor
Found in gpm_player/common.py - About 3 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 _run_player has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _run_player(self):

        while True:
            tracks = self.get_tracks()
            if self.shuffle:
Severity: Minor
Found in gpm_player/common.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, *, email=None, password=None, interval=3, width=50,
Severity: Major
Found in gpm_player/common.py - About 1 hr to fix

    Function get_tracks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_tracks(self):
            self.prepare()
            stations = self.api.get_all_stations()
            print()
    
    
    Severity: Minor
    Found in gpm_player/station.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 choose_track_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def choose_track_id(track):
        try:
            track_id = track['storeId']
        except KeyError:
            try:
    Severity: Minor
    Found in gpm_player/common.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(player):
        arg = set_args()
    
        while True:
            try:
    Severity: Minor
    Found in gpm_player/common.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

    Severity
    Category
    Status
    Source
    Language