Showing 6 of 6 total issues
Function handle_command
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def handle_command(command, user, channel):
response = "Not sure what you mean. Use `help` command"
if db["suggested"].count() > 0:
if command.startswith(PLAY_ALL_COMMAND):
record = db["suggested"].find().limit(1).next()
- 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 suggestion_engine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def suggestion_engine():
if db['playlist'].find().count() == 0:
response = ""
related_songs = []
cursor = db['history'].find().limit(50)
- 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_artists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_artists(query):
video_data = youtube_search.search({'q': query, 'max_results': 5})
if video_data:
tokens = []
for datum in video_data:
- 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_related_artists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_related_artists(token):
results = spotify.search(q='artist:' + token, type='artist')
items = results['artists']['items']
if len(items) > 0:
- 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 parse_slack_output
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_slack_output(slack_rtm_output):
command = None
user = None
channel = None
- 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 play
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def play(slack_client, command, user, channel):
play_list_coll = db['playlist']
request_record = {
"requested_by": user,
"requested_at": long(time.time())
- 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"