TeamSven/nathas

View on GitHub

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()
Severity: Minor
Found in nathas.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 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)
Severity: Minor
Found in nathas.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 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:
Severity: Minor
Found in youtube_util.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 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:
Severity: Minor
Found in spotify_util.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 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

Severity: Minor
Found in nathas.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 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())
Severity: Minor
Found in commands.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

Severity
Category
Status
Source
Language