gmusicprocurator/views/proxy.py
File proxy.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Mark Lee
#
# This program is free software: you can redistribute it and/or modify
Function gmusic_playlist_to_xspf
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def gmusic_playlist_to_xspf(playlist_id, playlist):
"""
Convert a playlist from gmusicapi into an XSPF playlist.
:type playlist: dict
- 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_song_mp3
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_song_mp3(song_id):
"""Retrieve the MP3 for a given ID."""
song_url = music.get_stream_url(song_id, app.config['GACCOUNT_DEVICE_ID'])
if app.config['GMP_SONG_FILTERS']:
response = requests.get(song_url)
- 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"